Refresh screen via call back set by lcdSetFlushCb
This commit is contained in:
committed by
Raphael Coeffic
parent
66cdab37ff
commit
db684893e2
@@ -43,7 +43,22 @@
|
||||
#define VFP 2
|
||||
#endif
|
||||
|
||||
uint8_t LCD_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
|
||||
static uint8_t LCD_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
|
||||
|
||||
static uint16_t* next_frame_buffer;
|
||||
static rect_t next_frame_area;
|
||||
|
||||
static void startLcdRefresh(lv_disp_drv_t *disp_drv, uint16_t *buffer,
|
||||
const rect_t ©_area)
|
||||
{
|
||||
(void)disp_drv;
|
||||
|
||||
next_frame_buffer = buffer;
|
||||
next_frame_area = copy_area;
|
||||
|
||||
// Enable line IRQ
|
||||
LTDC_ITConfig(LTDC_IER_LIE, ENABLE);
|
||||
}
|
||||
|
||||
inline void LCD_NRST_LOW()
|
||||
{
|
||||
@@ -321,6 +336,8 @@ void lcdInit()
|
||||
|
||||
// Enable LCD display
|
||||
LTDC_Cmd(ENABLE);
|
||||
|
||||
lcdSetFlushCb(startLcdRefresh);
|
||||
}
|
||||
|
||||
void DMAFillRect(uint16_t *dest, uint16_t destw, uint16_t desth, uint16_t x,
|
||||
@@ -575,9 +592,6 @@ void lcdCopy(void * dest, void * src)
|
||||
while (DMA2D_GetFlagStatus(DMA2D_FLAG_TC) == RESET);
|
||||
}
|
||||
|
||||
static uint16_t* next_frame_buffer;
|
||||
static rect_t next_frame_area;
|
||||
|
||||
extern "C" void LTDC_IRQHandler(void)
|
||||
{
|
||||
// clear interrupt flag
|
||||
@@ -594,12 +608,3 @@ extern "C" void LTDC_IRQHandler(void)
|
||||
lcdFlushed();
|
||||
}
|
||||
|
||||
void newLcdRefresh(uint16_t * buffer, const rect_t& copy_area)
|
||||
{
|
||||
next_frame_buffer = buffer;
|
||||
next_frame_area = copy_area;
|
||||
|
||||
// Enable line IRQ
|
||||
LTDC_ITConfig(LTDC_IER_LIE, ENABLE);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,22 @@
|
||||
#include "libopenui_config.h"
|
||||
#include "lcd.h"
|
||||
|
||||
uint8_t LCD_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
|
||||
static uint8_t LCD_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
|
||||
|
||||
static uint16_t* next_frame_buffer;
|
||||
static rect_t next_frame_area;
|
||||
|
||||
static void startLcdRefresh(lv_disp_drv_t *disp_drv, uint16_t *buffer,
|
||||
const rect_t ©_area)
|
||||
{
|
||||
(void)disp_drv;
|
||||
|
||||
next_frame_buffer = buffer;
|
||||
next_frame_area = copy_area;
|
||||
|
||||
// Enable line IRQ
|
||||
LTDC_ITConfig(LTDC_IER_LIE, ENABLE);
|
||||
}
|
||||
|
||||
lcdSpiInitFucPtr lcdInitFunction;
|
||||
lcdSpiInitFucPtr lcdOffFunction;
|
||||
@@ -1312,6 +1327,8 @@ void lcdInit(void)
|
||||
LCD_LayerInit();
|
||||
LTDC_Cmd(ENABLE);
|
||||
LTDC_ReloadConfig(LTDC_IMReload);
|
||||
|
||||
lcdSetFlushCb(startLcdRefresh);
|
||||
}
|
||||
|
||||
void DMAFillRect(uint16_t *dest, uint16_t destw, uint16_t desth, uint16_t x,
|
||||
@@ -1566,9 +1583,6 @@ void lcdCopy(void * dest, void * src)
|
||||
while (DMA2D_GetFlagStatus(DMA2D_FLAG_TC) == RESET);
|
||||
}
|
||||
|
||||
static uint16_t* next_frame_buffer;
|
||||
static rect_t next_frame_area;
|
||||
|
||||
extern "C" void LTDC_IRQHandler(void)
|
||||
{
|
||||
// clear interrupt flag
|
||||
@@ -1584,12 +1598,3 @@ extern "C" void LTDC_IRQHandler(void)
|
||||
// TODO: call on "Transfer Complete" IRQ
|
||||
lcdFlushed();
|
||||
}
|
||||
|
||||
void newLcdRefresh(uint16_t * buffer, const rect_t& copy_area)
|
||||
{
|
||||
next_frame_buffer = buffer;
|
||||
next_frame_area = copy_area;
|
||||
|
||||
// Enable line IRQ
|
||||
LTDC_ITConfig(LTDC_IER_LIE, ENABLE);
|
||||
}
|
||||
|
||||
@@ -146,13 +146,6 @@ static void* bootloaderThread(void*)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void lcdExitHandler(lv_disp_drv_t*)
|
||||
{
|
||||
if (simu_shutdown) {
|
||||
lcdFlushed();
|
||||
}
|
||||
}
|
||||
|
||||
void simuStart(bool tests, const char * sdPath, const char * settingsPath)
|
||||
{
|
||||
if (simu_running)
|
||||
@@ -211,8 +204,6 @@ void simuStart(bool tests, const char * sdPath, const char * settingsPath)
|
||||
try {
|
||||
#endif
|
||||
|
||||
lcdSetWaitCb(lcdExitHandler);
|
||||
|
||||
#if !defined(SIMU_BOOTLOADER)
|
||||
simuMain();
|
||||
#else
|
||||
|
||||
@@ -54,7 +54,9 @@ void lcdRefresh()
|
||||
|
||||
#else
|
||||
|
||||
void newLcdRefresh(uint16_t *buffer, const rect_t& copy_area)
|
||||
#include <lvgl/lvgl.h>
|
||||
|
||||
static void simuRefreshLcd(lv_disp_drv_t * disp_drv, uint16_t *buffer, const rect_t& copy_area)
|
||||
{
|
||||
#if defined(LCD_VERTICAL_INVERT)
|
||||
coord_t x1 = LCD_W - copy_area.w - copy_area.x;
|
||||
@@ -84,13 +86,28 @@ void newLcdRefresh(uint16_t *buffer, const rect_t& copy_area)
|
||||
dst += LCD_W - copy_area.w;
|
||||
}
|
||||
|
||||
// Mark screen dirty for async refresh
|
||||
simuLcdRefresh = true;
|
||||
if (lv_disp_flush_is_last(disp_drv)) {
|
||||
// Mark screen dirty for async refresh
|
||||
simuLcdRefresh = true;
|
||||
} else {
|
||||
lv_disp_flush_ready(disp_drv);
|
||||
}
|
||||
}
|
||||
|
||||
extern bool simu_shutdown;
|
||||
|
||||
static void simuLcdExitHandler(lv_disp_drv_t* disp_drv)
|
||||
{
|
||||
if (simu_shutdown) {
|
||||
lv_disp_flush_ready(disp_drv);
|
||||
}
|
||||
}
|
||||
|
||||
void lcdInit()
|
||||
{
|
||||
memset(simuLcdBuf, 0, sizeof(simuLcdBuf));
|
||||
lcdSetWaitCb(simuLcdExitHandler);
|
||||
lcdSetFlushCb(simuRefreshLcd);
|
||||
}
|
||||
|
||||
void DMAFillRect(uint16_t *dest, uint16_t destw, uint16_t desth, uint16_t x,
|
||||
|
||||
Reference in New Issue
Block a user