ESP8266-based RGBW controller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

53 lines
1.1 KiB

/*
* ESP8266 RGBW controller
* Copyright 2020 (c) Mark van Renswoude
*
* https://git.x2software.net/pub/RGBWifi
*/
#ifndef __Strip
#define __Strip
#include <NeoPixelBus.h>
#include <NeoPixelAnimator.h>
#include "./config.h"
enum StripSetting
{
Static = 0,
Rainbow = 1,
RainbowMoving = 2
};
class Strip
{
private:
NeoPixelBus<NeoPixelBusFeature, NeoPixelBusMethod>* mBus;
StripSetting mSetting;
NeoPixelAnimator* mAnimator = new NeoPixelAnimator(1, NEO_MILLISECONDS);
uint32_t mLastTick;
uint32_t mDelay;
RgbwColor mStaticColor;
uint16_t mRainbowSpeed = 0;
uint8_t mRainbowLightness = 128;
uint16_t mRainbowShift;
void tickRainbow();
public:
void init(uint16_t ledCount);
void tick();
void setStatic(const RgbwColor color, uint16_t fadeTime);
void setRainbow(uint16_t speed, uint8_t lightness);
StripSetting getSetting() { return mSetting; }
RgbwColor getStaticColor() { return mStaticColor; }
uint16_t getRainbowSpeed() { return mRainbowSpeed; }
uint8_t getRainbowLightness() { return mRainbowLightness; }
};
#endif