From 2cbb981eea60fad37497bf4bbff21986a11d7f01 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Tue, 28 May 2019 05:46:25 +0200 Subject: [PATCH] STarted reorganizing files into proper .h and .cpp files. --- {src => include}/animations.h | 19 ++++++------------- include/prototypes.h | 16 ++++++++++++++++ src/effects.h | 8 ++++++-- src/pitrix.ino | 2 +- 4 files changed, 29 insertions(+), 16 deletions(-) rename {src => include}/animations.h (99%) create mode 100644 include/prototypes.h diff --git a/src/animations.h b/include/animations.h similarity index 99% rename from src/animations.h rename to include/animations.h index 6cf3271..a08e8fb 100644 --- a/src/animations.h +++ b/include/animations.h @@ -30,19 +30,10 @@ .w and .h contain the dimensions of the image. **/ - -typedef struct { - uint8_t *colors; - uint8_t *data; - uint16_t *offsets; - uint16_t *delays; - boolean individual_delays; - int color_count; - int frame_count; - int w; - int h; -} AnimationData; - +#ifndef Animations_H +#define Animations_H +#include +#include "prototypes.h" uint8_t animation_koopa_colors[] PROGMEM = {182, 154, 17, 0, 0, 0, 48, 48, 48, 142, 4, 6, 254, 252, 255, 3, 1, 138, 17, 239, 18}; uint8_t animation_koopa_data[] PROGMEM = { @@ -159,3 +150,5 @@ uint8_t animation_heart_data[] PROGMEM = { uint16_t animation_heart_delays[] = {100, 100, 100, 100, 100, 100, 100, 400, 100, 100, 100, 100, 100, 100, 200}; uint16_t animation_heart_offsets[] = {0, 190, 344, 608, 875, 1025, 1291, 1588, 1790, 1944, 2208, 2473, 2627, 2893, 3190, 3392}; AnimationData animation_heart = {&animation_heart_colors[0], &animation_heart_data[0], &animation_heart_offsets[0], &animation_heart_delays[0], false, 4, 15, 32, 32}; + +#endif diff --git a/include/prototypes.h b/include/prototypes.h new file mode 100644 index 0000000..ffa6b13 --- /dev/null +++ b/include/prototypes.h @@ -0,0 +1,16 @@ +#ifndef prototypes_H +#define prototypes_H + +typedef struct { + uint8_t *colors; + uint8_t *data; + uint16_t *offsets; + uint16_t *delays; + boolean individual_delays; + int color_count; + int frame_count; + int w; + int h; +} AnimationData; + +#endif diff --git a/src/effects.h b/src/effects.h index a455ad7..99a73c4 100644 --- a/src/effects.h +++ b/src/effects.h @@ -1,3 +1,7 @@ +#include +#include +#include "prototypes.h" + struct EffectEntry { char* name; Effect* effect; @@ -285,12 +289,12 @@ class SingleDynamic : public Effect { } boolean can_be_shown_with_clock() { return true; } virtual void loop() { - EVERY_N_MILLISECONDS(getLoopTime()) { + EVERY_N_MILLISECONDS(getLoopTime()) { memcpy(old_tiles, tiles, tile_count*sizeof(CRGB)); blend = 0; update(); } - + for (int x=0; x* cycle_effects;