Skip to content

Commit 7ea3a22

Browse files
committed
idf proposed fixes. Tested also in Arduino IDE
1 parent 9c5c013 commit 7ea3a22

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

src/FastEPD.inl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "FastEPD.h"
1818
#include <esp_lcd_panel_io.h>
1919
#include <esp_lcd_panel_ops.h>
20-
20+
#include <esp_log.h>
2121
#if PSRAM != enabled && !defined(CONFIG_ESP32_SPIRAM_SUPPORT) && !defined(CONFIG_ESP32S3_SPIRAM_SUPPORT)
2222
#error "Please enable PSRAM support"
2323
#endif
@@ -939,6 +939,7 @@ void bbepWriteRow(FASTEPDSTATE *pState, uint8_t *pData, int iLen)
939939
}
940940
while (!transfer_is_done) {
941941
delayMicroseconds(1);
942+
vTaskDelay(0);
942943
}
943944
} /* bbepWriteRow() */
944945

@@ -955,6 +956,9 @@ uint8_t ucTemp[4];
955956
//
956957
int bbepIOInit(FASTEPDSTATE *pState)
957958
{
959+
#ifndef ARDUINO
960+
esp_log_level_set("gpio", ESP_LOG_NONE);
961+
#endif
958962
int rc = (*(pState->pfnIOInit))(pState);
959963
if (rc != BBEP_SUCCESS) return rc;
960964
// Initialize the ESP32 LCD API to drive parallel data at high speed
@@ -1351,6 +1355,7 @@ int bbepFullUpdate(FASTEPDSTATE *pState, bool bFast, bool bKeepOn, BBEPRECT *pRe
13511355
d[n + 3] = (pGrayUpper[pass * 256 + s[6]] | pGrayLower[pass * 256 + s[7]]);
13521356
s += 8;
13531357
} // for j
1358+
vTaskDelay(0);
13541359
}
13551360
if (iStartCol > 0 || iEndCol < pState->native_width-1) { // There is a region rectangle defined, clip the output to it
13561361
uint32_t *src, *dst;

src/arduino_io.inl

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ static uint8_t u8SDA_Pin, u8SCL_Pin;
2929
static int iDelay = 1;
3030
#endif
3131

32+
#include "rom/ets_sys.h"
3233
#ifndef ARDUINO
3334
#include "driver/gpio.h"
34-
#include "driver/i2c.h"
3535
#include "esp_timer.h"
3636

3737
// GPIO modes
@@ -55,25 +55,11 @@ unsigned long millis(void)
5555
{
5656
return micros() / 1000;
5757
}
58+
5859
void IRAM_ATTR delayMicroseconds(uint32_t us)
5960
{
60-
uint32_t m = micros();
61-
if (us)
62-
{
63-
uint32_t e = (m + us);
64-
if (m > e)
65-
{ //overflow
66-
while (micros() > e)
67-
{
68-
__asm__ __volatile__("nop\n");
69-
}
70-
}
71-
while (micros() < e)
72-
{
73-
__asm__ __volatile__("nop\n");
74-
}
75-
}
76-
} /* delayMicroseconds() */
61+
ets_delay_us(us);
62+
}
7763

7864
void delay(uint32_t ms)
7965
{

0 commit comments

Comments
 (0)