Update ESP32-HUB75-MatrixPanel-I2S-DMA.cpp

This commit is contained in:
mrfaptastic 2021-06-10 15:59:31 +01:00
parent 5ffb913d56
commit c25557990e

View file

@ -76,6 +76,7 @@
#define COLOR_DEPTH_LESS_THAN_8BIT_ADJUST // Nothing to adjust. #define COLOR_DEPTH_LESS_THAN_8BIT_ADJUST // Nothing to adjust.
#endif #endif
bool MatrixPanel_I2S_DMA::allocateDMAmemory() bool MatrixPanel_I2S_DMA::allocateDMAmemory()
{ {
@ -511,7 +512,12 @@ void IRAM_ATTR MatrixPanel_I2S_DMA::updateMatrixDMABuffer(int16_t x_coord, int16
uint8_t color_depth_idx = PIXEL_COLOR_DEPTH_BITS; uint8_t color_depth_idx = PIXEL_COLOR_DEPTH_BITS;
do { do {
--color_depth_idx; --color_depth_idx;
uint8_t mask = (1 << (color_depth_idx COLOR_DEPTH_LESS_THAN_8BIT_ADJUST)); // expect 24 bit color (8 bits per RGB subpixel) // uint8_t mask = (1 << (color_depth_idx COLOR_DEPTH_LESS_THAN_8BIT_ADJUST)); // expect 24 bit color (8 bits per RGB subpixel)
#if PIXEL_COLOR_DEPTH_BITS < 8
uint8_t mask = (1 << (color_depth_idx+(8-PIXEL_COLOR_DEPTH_BITS))); // expect 24 bit color (8 bits per RGB subpixel)
#else
uint8_t mask = (1 << (color_depth_idx)); // expect 24 bit color (8 bits per RGB subpixel)
#endif
uint16_t RGB_output_bits = 0; uint16_t RGB_output_bits = 0;
/* Per the .h file, the order of the output RGB bits is: /* Per the .h file, the order of the output RGB bits is:
@ -553,7 +559,12 @@ void MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint8_t red, uint8_t green, uint
{ {
// let's precalculate RGB1 and RGB2 bits than flood it over the entire DMA buffer // let's precalculate RGB1 and RGB2 bits than flood it over the entire DMA buffer
uint16_t RGB_output_bits = 0; uint16_t RGB_output_bits = 0;
uint8_t mask = (1 << color_depth_idx COLOR_DEPTH_LESS_THAN_8BIT_ADJUST); // 24 bit color // uint8_t mask = (1 << color_depth_idx COLOR_DEPTH_LESS_THAN_8BIT_ADJUST); // 24 bit color
#if PIXEL_COLOR_DEPTH_BITS < 8
uint8_t mask = (1 << (color_depth_idx+(8-PIXEL_COLOR_DEPTH_BITS))); // expect 24 bit color (8 bits per RGB subpixel)
#else
uint8_t mask = (1 << (color_depth_idx)); // expect 24 bit color (8 bits per RGB subpixel)
#endif
/* Per the .h file, the order of the output RGB bits is: /* Per the .h file, the order of the output RGB bits is:
* BIT_B2, BIT_G2, BIT_R2, BIT_B1, BIT_G1, BIT_R1 */ * BIT_B2, BIT_G2, BIT_R2, BIT_B1, BIT_G1, BIT_R1 */
@ -797,7 +808,12 @@ void MatrixPanel_I2S_DMA::hlineDMA(int16_t x_coord, int16_t y_coord, int16_t l,
// let's precalculate RGB1 and RGB2 bits than flood it over the entire DMA buffer // let's precalculate RGB1 and RGB2 bits than flood it over the entire DMA buffer
uint16_t RGB_output_bits = 0; uint16_t RGB_output_bits = 0;
uint8_t mask = (1 << color_depth_idx COLOR_DEPTH_LESS_THAN_8BIT_ADJUST); // uint8_t mask = (1 << color_depth_idx COLOR_DEPTH_LESS_THAN_8BIT_ADJUST);
#if PIXEL_COLOR_DEPTH_BITS < 8
uint8_t mask = (1 << (color_depth_idx+(8-PIXEL_COLOR_DEPTH_BITS))); // expect 24 bit color (8 bits per RGB subpixel)
#else
uint8_t mask = (1 << (color_depth_idx)); // expect 24 bit color (8 bits per RGB subpixel)
#endif
/* Per the .h file, the order of the output RGB bits is: /* Per the .h file, the order of the output RGB bits is:
* BIT_B2, BIT_G2, BIT_R2, BIT_B1, BIT_G1, BIT_R1 */ * BIT_B2, BIT_G2, BIT_R2, BIT_B1, BIT_G1, BIT_R1 */
@ -859,7 +875,12 @@ void MatrixPanel_I2S_DMA::vlineDMA(int16_t x_coord, int16_t y_coord, int16_t l,
--color_depth_idx; --color_depth_idx;
// let's precalculate RGB1 and RGB2 bits than flood it over the entire DMA buffer // let's precalculate RGB1 and RGB2 bits than flood it over the entire DMA buffer
uint8_t mask = (1 << color_depth_idx COLOR_DEPTH_LESS_THAN_8BIT_ADJUST); // uint8_t mask = (1 << color_depth_idx COLOR_DEPTH_LESS_THAN_8BIT_ADJUST);
#if PIXEL_COLOR_DEPTH_BITS < 8
uint8_t mask = (1 << (color_depth_idx+(8-PIXEL_COLOR_DEPTH_BITS))); // expect 24 bit color (8 bits per RGB subpixel)
#else
uint8_t mask = (1 << (color_depth_idx)); // expect 24 bit color (8 bits per RGB subpixel)
#endif
uint16_t RGB_output_bits = 0; uint16_t RGB_output_bits = 0;
/* Per the .h file, the order of the output RGB bits is: /* Per the .h file, the order of the output RGB bits is: