Refresh screen via call back set by lcdSetFlushCb

This commit is contained in:
Raphael Coeffic
2022-06-11 15:38:08 +02:00
committed by Raphael Coeffic
parent 66cdab37ff
commit db684893e2
6 changed files with 69 additions and 40 deletions
+18 -13
View File
@@ -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 &copy_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);
}