Fix: allow 80MHz clock speed

This commit is contained in:
Dorian Zedler 2024-08-20 13:12:32 +02:00
parent b67bd96067
commit 95dccdcc38
Signed by: dorian
GPG key ID: 989DE36109AFA354
2 changed files with 560 additions and 561 deletions

View file

@ -135,10 +135,10 @@ struct rowBitStruct
const bool double_buff;
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
*
* 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
*
*/
@ -151,7 +151,7 @@ struct rowBitStruct
/** @brief
* 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
* every loop cycle, better use inlined #define instead in such cases
*/
@ -306,7 +306,7 @@ struct HUB75_I2S_CFG
bool clkphase;
// 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
HUB75_I2S_CFG(
@ -491,14 +491,13 @@ public:
{
uint8_t r, g, b;
color565to888(color, r, g, b);
int16_t w = 1;
transform(x, y, w, h);
if (h > w)
vlineDMA(x, y, h, r, g, b);
else
hlineDMA(x, y, w, r, g, b);
}
// rgb888 overload
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);
else
hlineDMA(x, y, w, r, g, b);
}
// rgb888 overload
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;
color565to888(color, r, g, b);
transform(x, y, w, h);
fillRectDMA(x, y, w, h, r, g, b);
}
// 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)
{
transform(x, y, w, h);
fillRectDMA(x, y, w, h, r, g, b);
}
#endif
@ -572,8 +568,8 @@ public:
#endif
#ifdef NO_GFX
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 width() const { return m_cfg.mx_width * m_cfg.chain_length; }
inline int16_t height() const { return m_cfg.mx_height; }
#endif
void drawIcon(int *ico, int16_t x, int16_t y, int16_t cols, int16_t rows);
@ -600,15 +596,12 @@ public:
{
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()
{
clearFrameBuffer(0);
brtCtrlOEv2(brightness, 0);
clearFrameBuffer(0);
brtCtrlOEv2(brightness, 0);
if (m_cfg.double_buff) {
clearFrameBuffer(1);
if (m_cfg.double_buff)
{
clearFrameBuffer(1);
brtCtrlOEv2(brightness, 1);
}
}
@ -777,7 +770,7 @@ private:
/**
* @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
@ -841,7 +834,6 @@ protected:
Bus_Parallel16 dma_bus;
private:
// Matrix i2s settings
HUB75_I2S_CFG m_cfg;
@ -855,9 +847,9 @@ private:
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(...)
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 lsbMsbTransitionBit = 0; // For colour depth calculations
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 lsbMsbTransitionBit = 0; // For colour depth calculations
/* ESP32-HUB75-MatrixPanel-I2S-DMA functioning constants
* we should not those once object instance initialized it's DMA structs

File diff suppressed because it is too large Load diff