ESPectro32 Library
Library for using ESPectro32 board
 All Classes Functions Variables Enumerations Enumerator Pages
ESPectro32_RGBLED_Animation.h
1 /*
2  * ESPectro32_RGBLED_Animation.h
3  *
4  * Created on: Aug 19, 2017
5  * Author: andri
6  */
7 
8 #ifndef COMPONENTS_ESPECTRO32_SRC_ESPECTRO32_RGBLED_ANIMATION_H_
9 #define COMPONENTS_ESPECTRO32_SRC_ESPECTRO32_RGBLED_ANIMATION_H_
10 
11 #include <Animator.h>
12 #include "ESPectro32_RGBLED.h"
13 #include "esp_log.h"
14 
15 #define DEBUG_RGBLED_ANIM 1
16 
17 #if DEBUG_RGBLED_ANIM
18 #define RGBLED_ANIM_DEBUG_PRINT(...) ESP_LOGI("ESP32_ANIM", __VA_ARGS__); //ESP_LOGD("ESP32_ANIM", __VA_ARGS__);
19 #else
20 #define RGBLED_ANIM_DEBUG_PRINT(...)
21 #endif
22 
28 public:
30  virtual ~ESPectro32_RGBLED_Animation();
31 
32  void start();
33  void start(Animator::AnimationUpdateCallback animUpdateCallback, Animator::AnimationFinishedCallback animFinishedCallback,
34  uint16_t duration = 0, uint16_t updateInterval = 0);
35  void stop();
36  void run();
37  void onAnimationCompleted(Animator::AnimationFinishedCallback cb) {
38  animCompletedCb_ = cb;
39  }
40 
41  ESPectro32_RGBLED &RgbLed() {
42  return rgbLed_;
43  }
44 
45 protected:
46  ESPectro32_RGBLED &rgbLed_;
47  RgbLedColor_t &defaultColor_;
48  Animator *animator_ = NULL;
49 
50  Animator::AnimationFinishedCallback animCompletedCb_ = NULL;
51  boolean animationPrevStarted_ = false;
52 
53  uint16_t animCompletedCount_ = 0, animMaxCount_ = 0;
54  bool forceStop_ = false;
55 
56  Animator *getAnimatorPtr();
57 };
58 
64 public:
67 
74  void start(uint16_t duration = 0, uint16_t count = 0);
75  void stop();
76 };
77 
78 
84 public:
87 
94  void start(uint16_t duration = 0, uint16_t count = 0);
95  void stop();
96 };
97 
98 #endif /* COMPONENTS_ESPECTRO32_SRC_ESPECTRO32_RGBLED_ANIMATION_H_ */
A class of Neopixel RGB LED glowing animation.
Definition: ESPectro32_RGBLED_Animation.h:83
void start(uint16_t duration=0, uint16_t count=0)
Start the animation.
Definition: ESPectro32_RGBLED_Animation.cpp:85
RGB LED class.
Definition: ESPectro32_RGBLED.h:20
Base class of Neopixel RGB LED animation. You should provide callback for animUpdateCallback.
Definition: ESPectro32_RGBLED_Animation.h:27
Definition: RgbLedColor.h:25
void start(uint16_t duration=0, uint16_t count=0)
Start the animation.
Definition: ESPectro32_RGBLED_Animation.cpp:138
Definition: Animator.h:15
A class of Neopixel RGB LED fading in/out animation.
Definition: ESPectro32_RGBLED_Animation.h:63