From 61e3f1803b3cd24ba1483d28003180b9255a3c5a Mon Sep 17 00:00:00 2001 From: Jeroen Domburg Date: Mon, 29 May 2017 21:14:10 +0800 Subject: [PATCH] Mipi on SPI works.... but not with a big buffer. --- components/tme-esp32/main.c | 2 +- components/tme-esp32/mipi_lcd.c | 19 ++++++++++++++----- sdkconfig | 4 ++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/components/tme-esp32/main.c b/components/tme-esp32/main.c index 533e319..530102d 100644 --- a/components/tme-esp32/main.c +++ b/components/tme-esp32/main.c @@ -61,6 +61,6 @@ void app_main() if (err!=ESP_OK) printf("Couldn't map bootrom part!\n"); printf("Starting emu...\n"); // xTaskCreatePinnedToCore(&mouseTask, "mouse", 6*1024, NULL, 6, NULL, 0); - xTaskCreatePinnedToCore(&emuTask, "emu", 6*1024, NULL, 5, NULL, 0); + xTaskCreatePinnedToCore(&emuTask, "emu", 8*1024, NULL, 5, NULL, 0); } diff --git a/components/tme-esp32/mipi_lcd.c b/components/tme-esp32/mipi_lcd.c index 262db49..3991d41 100644 --- a/components/tme-esp32/mipi_lcd.c +++ b/components/tme-esp32/mipi_lcd.c @@ -221,6 +221,8 @@ int findPixelVal(uint8_t *data, int x, int y) { volatile static uint8_t *currFbPtr=NULL; SemaphoreHandle_t dispSem = NULL; +#define LINESPERBUF 8 + void IRAM_ATTR displayTask(void *arg) { mipiInit(); @@ -238,22 +240,29 @@ void IRAM_ATTR displayTask(void *arg) { } printf("Inited.\n"); - uint8_t img[641]; + uint8_t *img=malloc((LINESPERBUF*320*2)+1); + assert(img); while(1) { + int l=0; + mipiResync(); xSemaphoreTake(dispSem, portMAX_DELAY); uint8_t *myData=(uint8_t*)currFbPtr; - uint8_t img[641]; img[0]=0x2c; + uint8_t *p=&img[1]; for (int j=0; j<320; j++) { - uint8_t *p=&img[1]; for (int i=0; i<320; i++) { int v=findPixelVal(myData, i, j); *p++=(v&0xff); *p++=(v>>8); } - mipiDsiSendLong(0x39, img, sizeof(img)+4); - img[0]=0x3c; + l++; + if (l>=LINESPERBUF || j==319) { + //mipiDsiSendLong(0x39, img, (LINESPERBUF*320*2)+1); + img[0]=0x3c; + l=0; + *p=&img[1]; + } } } } diff --git a/sdkconfig b/sdkconfig index 82f04db..5784833 100644 --- a/sdkconfig +++ b/sdkconfig @@ -180,7 +180,7 @@ CONFIG_FATFS_MAX_LFN=255 # # FreeRTOS # -# CONFIG_FREERTOS_UNICORE is not set +CONFIG_FREERTOS_UNICORE=y CONFIG_FREERTOS_CORETIMER_0=y # CONFIG_FREERTOS_CORETIMER_1 is not set CONFIG_FREERTOS_HZ=100 @@ -188,7 +188,7 @@ CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y -# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set +CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y # CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set