Program Listing for File Segment.h

Return to documentation for file (lib/LED_clock/Modules/SevenSegment/inc/Segment.h)

#ifndef __SEGMENT_H_
#define __SEGMENT_H_

#include <Arduino.h>
#include "AnimatableObject.h"
#define FASTLED_INTERNAL
#include "FastLED.h"


class AnimationEffects;

class Segment: public AnimatableObject
{
public:
    enum direction {LEFT_TO_RIGHT = false, RIGHT_TO_LEFT = true, TOP_TO_BOTTTOM = false, BOTTOM_TO_TOP = true};

private:
    friend class AnimationEffects;

    uint8_t length;
    bool invertDirection;
    CRGB color;
    CRGB AnimationColor;
    CRGB* leds;

    void writeToLEDs(CRGB colorToSet);

    bool isOn();

public:
    Segment(CRGB LEDBuffer[], uint16_t indexOfFirstLEDInSegment, uint8_t segmentLength, direction Direction, CRGB segmentColor = CRGB::Black);

    ~Segment();

    void tick(int32_t currentState);

    void setColor(CRGB SegmentColor);

    void updateColor(CRGB SegmentColor);


    void display();

    void off();

    void updateAnimationColor(CRGB newColor);
};


#endif