ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
ESP32DevKitV1.h
Go to the documentation of this file.
1#include <Arduino.h>
2
3#include "Controller.h"
4#include "Render/Camera.h"
5
6//HUB75
7#include <ESP32-VirtualMatrixPanel-I2S-DMA.h>
8#include <FastLED.h>
9
10// Configure for your panel(s) as appropriate!
11#define PANEL_RES_X 64 // Number of pixels wide of each INDIVIDUAL panel module.
12#define PANEL_RES_Y 32 // Number of pixels tall of each INDIVIDUAL panel module.
13
14#define NUM_ROWS 2 // Number of rows of chained INDIVIDUAL PANELS
15#define NUM_COLS 1 // Number of INDIVIDUAL PANELS per ROW
16#define PANEL_CHAIN NUM_ROWS*NUM_COLS // total number of panels chained one to another
17
18// Change this to your needs, for details on VirtualPanel pls read the PDF!
19#define SERPENT true
20
21
22// placeholder for the matrix object
23MatrixPanel_I2S_DMA *dma_display = nullptr;
24
25// placeholder for the virtual display object
26VirtualMatrixPanel *virtualDisp = nullptr;
27
28class ESP32DevKitV1 : public Controller {
29private:
32
33 Vector2D size = Vector2D(192.0f, 96.0f);
34 Vector2D position = Vector2D(0.0f, 0.0f);
35
38
41
42 //Camera* cameras[1] = { &camMain1 };
44
45public:
47
48 void Initialize() override{
49
50 HUB75_I2S_CFG mxconfig(
51 PANEL_RES_X, // module width
52 PANEL_RES_Y, // module height
53 PANEL_CHAIN // chain length
54 );
55
56 // OK, now we can create our matrix object
57 dma_display = new MatrixPanel_I2S_DMA(mxconfig);
58
59 // let's adjust default brightness to about 75%
60 dma_display->setBrightness8(128); // range is 0-255, 0 - 0%, 255 - 100%
61
62 // Allocate memory and start DMA display
63 if(!dma_display->begin()){
64 Serial.println("****** I2S memory allocation failed ***********");
65 }
66
67 // create VirtualDisplay object based on our newly created dma_display object
68 virtualDisp = new VirtualMatrixPanel((*dma_display), NUM_ROWS, NUM_COLS, PANEL_RES_X, PANEL_RES_Y, SERPENT);
69
70 dma_display->clearScreen();
71 }
72
73 void Display() override {
74 dma_display->setBrightness8(brightness);
75
76 for (uint16_t y = 0; y < 32; y++) {
77 for (uint16_t x = 0; x < 64; x++){
78 uint16_t pixelNum = y * 64 + x;
79
80 virtualDisp->drawPixelRGB888(x, y, (uint8_t)camPixels1.GetColor(pixelNum)->R, (uint8_t)camPixels1.GetColor(pixelNum)->G, (uint8_t)camPixels1.GetColor(pixelNum)->B);
81 }
82 }
83
84 for (uint16_t y = 0; y < 32; y++) {
85 for (uint16_t x = 0; x < 64; x++){
86 uint16_t pixelNum = y * 64 + x;
87
88 virtualDisp->drawPixelRGB888(x, y + 32, (uint8_t)camPixels2.GetColor(pixelNum)->R, (uint8_t)camPixels2.GetColor(pixelNum)->G, (uint8_t)camPixels2.GetColor(pixelNum)->B);
89 }
90 }
91 }
92};
Declares the Controller base class for managing lighting controllers.
#define NUM_COLS
#define PANEL_RES_Y
#define PANEL_RES_X
#define PANEL_CHAIN
#define NUM_ROWS
VirtualMatrixPanel * virtualDisp
MatrixPanel_I2S_DMA * dma_display
#define SERPENT
Manages camera behavior and pixel groups.
Definition Camera.h:27
Base class for managing brightness and display operations of lighting controllers.
Definition Controller.h:25
uint8_t brightness
Current brightness level.
Definition Controller.h:32
uint8_t maxBrightness
Maximum allowed brightness level.
Definition Controller.h:34
void Initialize() override
Initializes the controller.
Vector2D position
Camera * cameras[2]
void Display() override
Updates and displays content on the lighting system.
Transform camTransform2
PixelGroup camPixels2
ESP32DevKitV1(uint8_t maxBrightness)
Transform camTransform1
PixelGroup camPixels1
Manages a collection of pixels with positions, colors, and spatial relationships.
Definition PixelGroup.h:27
RGBColor * GetColor(uint16_t count) override
Retrieves the color of a specific pixel.
uint8_t B
Blue component of the color (0-255).
Definition RGBColor.h:27
uint8_t G
Green component of the color (0-255).
Definition RGBColor.h:26
uint8_t R
Red component of the color (0-255).
Definition RGBColor.h:25
Represents a 3D transformation including position, rotation, and scale.
Definition Transform.h:22
Represents a 2D vector (X, Y) and provides methods for vector arithmetic.
Definition Vector2D.h:27
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26