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/vector.h"
15#include "crgb.h"
16#include "fl/screenmap.h"
17
18using namespace fl;
19
20// LedRopeTCL is a C++ wrapper around the Total Control Lighting LED rope
21// device driver (TCL.h). This wrapper includes automatic setup of the LED
22// rope and allows the user to use a graphics-state like interface for
23// talking to the rope. A copy of the rope led state is held in this class
24// which makes blending operations easier. After all changes by the user
25// are applied to the rope, the hardware is updated via an explicit Draw()
26// command.
27//
28// Whole-rope blink Example:
29// #include <SPI.h>
30// #include <TCL.h> // From CoolNeon (https://bitbucket.org/devries/arduino-tcl)
31// #include "LedRopeTCL.h"
32// LedRopeTCL led_rope(100); // 100 led-strand.
33//
34// void setup() {} // No setup necessary for Led rope.
35// void loop() {
36// led_rope.FillColor(LedRopeTCL::Color3i::Black());
37// led_rope.Draw();
38// delay(1000);
39// led_rope.FillColor(LedRopeTCL::Color3i::White());
40// led_rope.Draw();
41// delay(1000);
42// }
43
44
46 public:
47 LedRopeTCL(int n_pixels);
48 virtual ~LedRopeTCL();
49
50 void Draw();
51 void DrawSequentialRepeat(int repeat);
52 void DrawRepeat(const int* value_array, int array_length);
53 void set_draw_offset(int val);
54
55 virtual void Set(int i, const Color3i& c) {
56 frame_buffer_.Set(i, c);
57 }
58
60 return frame_buffer_.GetIterator(i);
61 }
62
63 int length() const { return frame_buffer_.length(); }
64
65 void RawBeginDraw();
66 void RawDrawPixel(const Color3i& c);
67 void RawDrawPixels(const Color3i& c, int n);
68 void RawDrawPixel(uint8_t r, uint8_t g, uint8_t b);
69 void RawCommitDraw();
70
71 protected:
72 void PreDrawSetup();
73 int draw_offset_ = 0;
76 bool controller_added_ = false;
79};
80
81#endif // LED_REPE_TCL_H_
fl::ScreenMap mScreenMap
Definition LedRopeTCL.h:78
fl::HeapVector< CRGB > led_buffer_
Definition LedRopeTCL.h:77
void RawCommitDraw()
bool lazy_initialized_
Definition LedRopeTCL.h:74
void RawDrawPixel(const Color3i &c)
void set_draw_offset(int val)
void PreDrawSetup()
void RawDrawPixels(const Color3i &c, int n)
virtual ~LedRopeTCL()
FrameBuffer frame_buffer_
Definition LedRopeTCL.h:75
Color3i * GetIterator(int i)
Definition LedRopeTCL.h:59
int length() const
Definition LedRopeTCL.h:63
bool controller_added_
Definition LedRopeTCL.h:76
void DrawSequentialRepeat(int repeat)
int draw_offset_
Definition LedRopeTCL.h:73
virtual void Set(int i, const Color3i &c)
Definition LedRopeTCL.h:55
LedRopeTCL(int n_pixels)
void RawBeginDraw()
void DrawRepeat(const int *value_array, int array_length)
Defines the red, green, and blue (RGB) pixel struct.
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16
Definition color.h:8