|
@@ -133,6 +133,27 @@ void tft_lvgl_init() {
|
|
|
|
|
|
watchdog_refresh(); // LVGL init takes time
|
|
|
|
|
|
+ #if ENABLED(USB_FLASH_DRIVE_SUPPORT)
|
|
|
+ uint16_t usb_flash_loop = 1000;
|
|
|
+ #if ENABLED(MULTI_VOLUME) && !HAS_SD_HOST_DRIVE
|
|
|
+ SET_INPUT_PULLUP(SD_DETECT_PIN);
|
|
|
+ if (READ(SD_DETECT_PIN) == LOW) card.changeMedia(&card.media_driver_sdcard);
|
|
|
+ else card.changeMedia(&card.media_driver_usbFlash);
|
|
|
+ #endif
|
|
|
+ do {
|
|
|
+ card.media_driver_usbFlash.idle();
|
|
|
+ watchdog_refresh();
|
|
|
+ delay(2);
|
|
|
+ } while (!card.media_driver_usbFlash.isInserted() && usb_flash_loop--);
|
|
|
+ card.mount();
|
|
|
+ #elif HAS_LOGO_IN_FLASH
|
|
|
+ delay(1000);
|
|
|
+ watchdog_refresh();
|
|
|
+ delay(1000);
|
|
|
+ #endif
|
|
|
+
|
|
|
+ watchdog_refresh(); // LVGL init takes time
|
|
|
+
|
|
|
#if ENABLED(SDSUPPORT)
|
|
|
UpdateAssets();
|
|
|
watchdog_refresh(); // LVGL init takes time
|
|
@@ -231,19 +252,44 @@ void tft_lvgl_init() {
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+static lv_disp_drv_t* disp_drv_p;
|
|
|
+
|
|
|
+#if ENABLED(USE_SPI_DMA_TC)
|
|
|
+ bool lcd_dma_trans_lock = false;
|
|
|
+#endif
|
|
|
+
|
|
|
+void dmc_tc_handler(struct __DMA_HandleTypeDef * hdma) {
|
|
|
+ #if ENABLED(USE_SPI_DMA_TC)
|
|
|
+ lv_disp_flush_ready(disp_drv_p);
|
|
|
+ lcd_dma_trans_lock = false;
|
|
|
+ TFT_SPI::Abort();
|
|
|
+ #endif
|
|
|
+}
|
|
|
+
|
|
|
void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p) {
|
|
|
uint16_t width = area->x2 - area->x1 + 1,
|
|
|
height = area->y2 - area->y1 + 1;
|
|
|
|
|
|
- SPI_TFT.setWindow((uint16_t)area->x1, (uint16_t)area->y1, width, height);
|
|
|
+ TERN_(USE_SPI_DMA_TC, disp_drv_p = disp);
|
|
|
|
|
|
- SPI_TFT.tftio.WriteSequence((uint16_t*)color_p, width * height);
|
|
|
+ SPI_TFT.setWindow((uint16_t)area->x1, (uint16_t)area->y1, width, height);
|
|
|
|
|
|
- lv_disp_flush_ready(disp); // Indicate you are ready with the flushing
|
|
|
+ #if ENABLED(USE_SPI_DMA_TC)
|
|
|
+ lcd_dma_trans_lock = true;
|
|
|
+ SPI_TFT.tftio.WriteSequenceIT((uint16_t*)color_p, width * height);
|
|
|
+ TFT_SPI::DMAtx.XferCpltCallback = dmc_tc_handler;
|
|
|
+ #else
|
|
|
+ SPI_TFT.tftio.WriteSequence((uint16_t*)color_p, width * height);
|
|
|
+ lv_disp_flush_ready(disp_drv_p); // Indicate you are ready with the flushing
|
|
|
+ #endif
|
|
|
|
|
|
W25QXX.init(SPI_QUARTER_SPEED);
|
|
|
}
|
|
|
|
|
|
+#if ENABLED(USE_SPI_DMA_TC)
|
|
|
+ bool get_lcd_dma_lock() { return lcd_dma_trans_lock; }
|
|
|
+#endif
|
|
|
+
|
|
|
void lv_fill_rect(lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2, lv_color_t bk_color) {
|
|
|
uint16_t width, height;
|
|
|
width = x2 - x1 + 1;
|