Compare commits

...

1 commit

Author SHA1 Message Date
95dccdcc38
Fix: allow 80MHz clock speed 2024-08-20 13:12:32 +02:00
2 changed files with 560 additions and 561 deletions

View file

@ -135,10 +135,10 @@ struct rowBitStruct
const bool double_buff; const bool double_buff;
ESP32_I2S_DMA_STORAGE_TYPE *data; ESP32_I2S_DMA_STORAGE_TYPE *data;
/** @brief /** @brief
* Returns size (in bytes) of row of data vectorfor a SINGLE buff for the number of colour depths requested * Returns size (in bytes) of row of data vectorfor a SINGLE buff for the number of colour depths requested
* *
* default - Returns full data vector size for a SINGLE buff. * default - Returns full data vector size for a SINGLE buff.
* You should only pass either PIXEL_COLOR_DEPTH_BITS or '1' to this * You should only pass either PIXEL_COLOR_DEPTH_BITS or '1' to this
* *
*/ */
@ -151,7 +151,7 @@ struct rowBitStruct
/** @brief /** @brief
* Returns pointer to the row's data vector beginning at pixel[0] for _dpth colour bit * Returns pointer to the row's data vector beginning at pixel[0] for _dpth colour bit
* *
* NOTE: this call might be very slow in loops. Due to poor instruction caching in esp32 it might be required a reread from flash * NOTE: this call might be very slow in loops. Due to poor instruction caching in esp32 it might be required a reread from flash
* every loop cycle, better use inlined #define instead in such cases * every loop cycle, better use inlined #define instead in such cases
*/ */
@ -306,7 +306,7 @@ struct HUB75_I2S_CFG
bool clkphase; bool clkphase;
// Minimum refresh / scan rate needs to be configured on start due to LSBMSB_TRANSITION_BIT calculation in allocateDMAmemory() // Minimum refresh / scan rate needs to be configured on start due to LSBMSB_TRANSITION_BIT calculation in allocateDMAmemory()
uint8_t min_refresh_rate; uint16_t min_refresh_rate;
// struct constructor // struct constructor
HUB75_I2S_CFG( HUB75_I2S_CFG(
@ -491,14 +491,13 @@ public:
{ {
uint8_t r, g, b; uint8_t r, g, b;
color565to888(color, r, g, b); color565to888(color, r, g, b);
int16_t w = 1; int16_t w = 1;
transform(x, y, w, h); transform(x, y, w, h);
if (h > w) if (h > w)
vlineDMA(x, y, h, r, g, b); vlineDMA(x, y, h, r, g, b);
else else
hlineDMA(x, y, w, r, g, b); hlineDMA(x, y, w, r, g, b);
} }
// rgb888 overload // rgb888 overload
virtual inline void drawFastVLine(int16_t x, int16_t y, int16_t h, uint8_t r, uint8_t g, uint8_t b) virtual inline void drawFastVLine(int16_t x, int16_t y, int16_t h, uint8_t r, uint8_t g, uint8_t b)
@ -526,7 +525,6 @@ public:
vlineDMA(x, y, h, r, g, b); vlineDMA(x, y, h, r, g, b);
else else
hlineDMA(x, y, w, r, g, b); hlineDMA(x, y, w, r, g, b);
} }
// rgb888 overload // rgb888 overload
virtual inline void drawFastHLine(int16_t x, int16_t y, int16_t w, uint8_t r, uint8_t g, uint8_t b) virtual inline void drawFastHLine(int16_t x, int16_t y, int16_t w, uint8_t r, uint8_t g, uint8_t b)
@ -547,18 +545,16 @@ public:
{ {
uint8_t r, g, b; uint8_t r, g, b;
color565to888(color, r, g, b); color565to888(color, r, g, b);
transform(x, y, w, h); transform(x, y, w, h);
fillRectDMA(x, y, w, h, r, g, b); fillRectDMA(x, y, w, h, r, g, b);
} }
// rgb888 overload // rgb888 overload
virtual inline void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint8_t r, uint8_t g, uint8_t b) virtual inline void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint8_t r, uint8_t g, uint8_t b)
{ {
transform(x, y, w, h); transform(x, y, w, h);
fillRectDMA(x, y, w, h, r, g, b); fillRectDMA(x, y, w, h, r, g, b);
} }
#endif #endif
@ -572,8 +568,8 @@ public:
#endif #endif
#ifdef NO_GFX #ifdef NO_GFX
inline int16_t width() const { return m_cfg.mx_width * m_cfg.chain_length; } inline int16_t width() const { return m_cfg.mx_width * m_cfg.chain_length; }
inline int16_t height() const { return m_cfg.mx_height; } inline int16_t height() const { return m_cfg.mx_height; }
#endif #endif
void drawIcon(int *ico, int16_t x, int16_t y, int16_t cols, int16_t rows); void drawIcon(int *ico, int16_t x, int16_t y, int16_t cols, int16_t rows);
@ -600,15 +596,12 @@ public:
{ {
return; return;
} }
dma_bus.flip_dma_output_buffer(back_buffer_id);
//back_buffer_id ^= 1;
back_buffer_id = back_buffer_id^1;
fb = &frame_buffer[back_buffer_id];
dma_bus.flip_dma_output_buffer(back_buffer_id);
// back_buffer_id ^= 1;
back_buffer_id = back_buffer_id ^ 1;
fb = &frame_buffer[back_buffer_id];
} }
/** /**
@ -713,14 +706,14 @@ protected:
*/ */
inline void resetbuffers() inline void resetbuffers()
{ {
clearFrameBuffer(0); clearFrameBuffer(0);
brtCtrlOEv2(brightness, 0); brtCtrlOEv2(brightness, 0);
if (m_cfg.double_buff) { if (m_cfg.double_buff)
{
clearFrameBuffer(1);
clearFrameBuffer(1);
brtCtrlOEv2(brightness, 1); brtCtrlOEv2(brightness, 1);
} }
} }
@ -777,7 +770,7 @@ private:
/** /**
* @brief - DP3246-family chips initialization routine * @brief - DP3246-family chips initialization routine
*/ */
void dp3246init(const HUB75_I2S_CFG& _cfg); void dp3246init(const HUB75_I2S_CFG &_cfg);
/** /**
* @brief - reset OE bits in DMA buffer in a way to control brightness * @brief - reset OE bits in DMA buffer in a way to control brightness
@ -841,7 +834,6 @@ protected:
Bus_Parallel16 dma_bus; Bus_Parallel16 dma_bus;
private: private:
// Matrix i2s settings // Matrix i2s settings
HUB75_I2S_CFG m_cfg; HUB75_I2S_CFG m_cfg;
@ -855,9 +847,9 @@ private:
frameStruct frame_buffer[2]; frameStruct frame_buffer[2];
frameStruct *fb; // What framebuffer we are writing pixel changes to? (pointer to either frame_buffer[0] or frame_buffer[1] basically ) used within updateMatrixDMABuffer(...) frameStruct *fb; // What framebuffer we are writing pixel changes to? (pointer to either frame_buffer[0] or frame_buffer[1] basically ) used within updateMatrixDMABuffer(...)
volatile int back_buffer_id = 0; // If using double buffer, which one is NOT active (ie. being displayed) to write too? volatile int back_buffer_id = 0; // If using double buffer, which one is NOT active (ie. being displayed) to write too?
int brightness = 128; // If you get ghosting... reduce brightness level. ((60/64)*255) seems to be the limit before ghosting on a 64 pixel wide physical panel for some panels. int brightness = 128; // If you get ghosting... reduce brightness level. ((60/64)*255) seems to be the limit before ghosting on a 64 pixel wide physical panel for some panels.
int lsbMsbTransitionBit = 0; // For colour depth calculations int lsbMsbTransitionBit = 0; // For colour depth calculations
/* ESP32-HUB75-MatrixPanel-I2S-DMA functioning constants /* ESP32-HUB75-MatrixPanel-I2S-DMA functioning constants
* we should not those once object instance initialized it's DMA structs * we should not those once object instance initialized it's DMA structs

File diff suppressed because it is too large Load diff