FastLED 3.9.15
Loading...
Searching...
No Matches
LedRopeTCL.h
Go to the documentation of this file.
1// Copyleft (c) 2012, Zach Vorhies
2// Public domain, no rights reserved.
3// This object holds a frame buffer and effects can be applied. This is a higher level
4// object than the TCL class which this object uses for drawing.
5
6#ifndef LED_REPE_TCL_H_
7#define LED_REPE_TCL_H_
8
9#include <Arduino.h>
10#include "../shared/color.h"
13
14#include "fl/stl/vector.h"
15#include "crgb.h"
16#include "fl/math/screenmap.h"
17
18
19// LedRopeTCL is a C++ wrapper around the Total Control Lighting LED rope
20// device driver (TCL.h). This wrapper includes automatic setup of the LED
21// rope and allows the user to use a graphics-state like interface for
22// talking to the rope. A copy of the rope led state is held in this class
23// which makes blending operations easier. After all changes by the user
24// are applied to the rope, the hardware is updated via an explicit Draw()
25// command.
26//
27// Whole-rope blink Example:
28// #include <SPI.h>
29// #include <TCL.h> // From CoolNeon (https://bitbucket.org/devries/arduino-tcl)
30// #include "LedRopeTCL.h"
31// LedRopeTCL led_rope(100); // 100 led-strand.
32//
33// void setup() {} // No setup necessary for Led rope.
34// void loop() {
35// led_rope.FillColor(LedRopeTCL::Color3i::Black());
36// led_rope.Draw();
37// delay(1000);
38// led_rope.FillColor(LedRopeTCL::Color3i::White());
39// led_rope.Draw();
40// delay(1000);
41// }
42
43
45 public:
46 LedRopeTCL(int n_pixels);
47 virtual ~LedRopeTCL();
48
49 void Draw();
50 void DrawSequentialRepeat(int repeat);
51 void DrawRepeat(const int* value_array, int array_length);
52 void set_draw_offset(int val);
53
54 virtual void Set(int i, const Color3i& c) {
55 mFrameBuffer.Set(i, c);
56 }
57
59 return mFrameBuffer.GetIterator(i);
60 }
61
62 int length() const { return mFrameBuffer.length(); }
63
64 void RawBeginDraw();
65 void RawDrawPixel(const Color3i& c);
66 void RawDrawPixels(const Color3i& c, int n);
67 void RawDrawPixel(uint8_t r, uint8_t g, uint8_t b);
68 void RawCommitDraw();
69
70 protected:
71 void PreDrawSetup();
72 int mDrawOffset = 0;
75 bool mControllerAdded = false;
78};
79
80#endif // LED_REPE_TCL_H_
fl::ScreenMap mScreenMap
Definition LedRopeTCL.h:77
FrameBuffer mFrameBuffer
Definition LedRopeTCL.h:74
void RawCommitDraw()
bool mLazyInitialized
Definition LedRopeTCL.h:73
void RawDrawPixel(const Color3i &c)
void set_draw_offset(int val)
void PreDrawSetup()
void RawDrawPixels(const Color3i &c, int n)
virtual ~LedRopeTCL()
int mDrawOffset
Definition LedRopeTCL.h:72
fl::vector< fl::CRGB > mLedBuffer
Definition LedRopeTCL.h:76
Color3i * GetIterator(int i)
Definition LedRopeTCL.h:58
int length() const
Definition LedRopeTCL.h:62
void DrawSequentialRepeat(int repeat)
virtual void Set(int i, const Color3i &c)
Definition LedRopeTCL.h:54
bool mControllerAdded
Definition LedRopeTCL.h:75
LedRopeTCL(int n_pixels)
void RawBeginDraw()
void DrawRepeat(const int *value_array, int array_length)
Definition color.h:6