aboutsummaryrefslogtreecommitdiff
path: root/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp
diff options
context:
space:
mode:
authormrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2023-03-11 12:01:44 +0000
committerGitHub <noreply@github.com>2023-03-11 12:01:44 +0000
commit1bb96e01754b7bdbbeffc6c4367760176b08e4cd (patch)
tree833b3a0fd9e3dc07e94977a933ca4503eee784ad /src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp
parent763aab6f097711420edbf10d84ec1e1bfa6d2f98 (diff)
parente807e622a89d737ca972ea44eeef44aef0850942 (diff)
Merge pull request #413 from Lukaswnd/master
Bugs with config and default constructor
Diffstat (limited to 'src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp')
-rw-r--r--src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp
index 2db698a..cf1915c 100644
--- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp
+++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp
@@ -367,7 +367,7 @@ uint16_t red16, green16, blue16;
uint8_t mask = (1 << (colour_depth_idx)); // expect 24 bit color (8 bits per RGB subpixel)
#endif
*/
- uint16_t mask = PIXEL_COLOR_MASK_BIT(colour_depth_idx, m_cfg.getMaskOffset());
+ uint16_t mask = PIXEL_COLOR_MASK_BIT(colour_depth_idx, MASK_OFFSET);
uint16_t RGB_output_bits = 0;
/* Per the .h file, the order of the output RGB bits is:
@@ -425,7 +425,7 @@ uint16_t red16, green16, blue16;
// uint8_t mask = (1 << (colour_depth_idx)); // expect 24 bit colour (8 bits per RGB subpixel)
// #endif
- uint16_t mask = PIXEL_COLOR_MASK_BIT(colour_depth_idx, m_cfg.getMaskOffset());
+ uint16_t mask = PIXEL_COLOR_MASK_BIT(colour_depth_idx, MASK_OFFSET);
/* Per the .h file, the order of the output RGB bits is:
* BIT_B2, BIT_G2, BIT_R2, BIT_B1, BIT_G1, BIT_R1 */
@@ -785,7 +785,7 @@ void MatrixPanel_I2S_DMA::brtCtrlOEv2(uint8_t brt, const int _buff_id) {
*/
bool MatrixPanel_I2S_DMA::begin(int r1, int g1, int b1, int r2, int g2, int b2, int a, int b, int c, int d, int e, int lat, int oe, int clk) {
-
+ if(initialized) return true;
// RGB
m_cfg.gpio.r1 = r1; m_cfg.gpio.g1 = g1; m_cfg.gpio.b1 = b1;
m_cfg.gpio.r2 = r2; m_cfg.gpio.g2 = g2; m_cfg.gpio.b2 = b2;
@@ -800,6 +800,15 @@ bool MatrixPanel_I2S_DMA::begin(int r1, int g1, int b1, int r2, int g2, int b2,
return begin();
}
+bool MatrixPanel_I2S_DMA::begin(const HUB75_I2S_CFG& cfg){
+ if(initialized) return true;
+
+ if(!setCfg(cfg)) return false;
+
+ return begin();
+}
+
+
/**
* @brief - Sets how many clock cycles to blank OE before/after LAT signal change
@@ -880,7 +889,7 @@ uint16_t red16, green16, blue16;
// #else
// uint8_t mask = (1 << (colour_depth_idx)); // expect 24 bit colour (8 bits per RGB subpixel)
// #endif
- uint16_t mask = PIXEL_COLOR_MASK_BIT(colour_depth_idx, m_cfg.getMaskOffset());
+ uint16_t mask = PIXEL_COLOR_MASK_BIT(colour_depth_idx, MASK_OFFSET);
/* Per the .h file, the order of the output RGB bits is:
* BIT_B2, BIT_G2, BIT_R2, BIT_B1, BIT_G1, BIT_R1 */
@@ -973,7 +982,7 @@ uint16_t red16, green16, blue16;
// uint8_t mask = (1 << (colour_depth_idx)); // expect 24 bit colour (8 bits per RGB subpixel)
// #endif
- uint16_t mask = PIXEL_COLOR_MASK_BIT(colour_depth_idx, m_cfg.getMaskOffset());
+ uint16_t mask = PIXEL_COLOR_MASK_BIT(colour_depth_idx, MASK_OFFSET);
uint16_t RGB_output_bits = 0;
/* Per the .h file, the order of the output RGB bits is: