#ifndef __Stairs #define __Stairs #include "components/PCA9685.h" #include "config.h" #include "settings/steps.h" struct Step { uint16_t currentValue; uint16_t startValue; uint16_t targetValue; uint16_t startTime; uint16_t endTime; }; class Stairs { private: PCA9685* mPWMDriver; Step mStep[MaxStepCount]; uint32_t mTransitionStart; bool mTick = false; protected: uint16_t getPWMValue(uint8_t step, uint8_t brightness); public: void init(PCA9685* pwmDriver); void tick(); uint8_t get(uint8_t step, bool target = true); void set(uint8_t step, uint8_t brightness, uint16_t transitionTime = 0, uint16_t startTime = 0); void setAll(uint8_t brightness, uint16_t transitionTime = 0, uint16_t startTime = 0); }; #endif