Hi inmarket & tectu Thanks to your reply, I'm now able to write in the off-screen buffer and refresh the screen on this aera. This help me to use a picture as background.. here is the diff I made to be able to do this index 5c20d3d..f0c52c5 --- a/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c +++ b/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c @@ -13,6 +13,7 @@ #include "drivers/gdisp/SSD1963/gdisp_lld_config.h" #include "src/gdisp/driver.h" + #define CALC_PERIOD(w,b,f,p) (p+b+w+f) #define CALC_FPR(w,h,hb,hf,hp,vb,vf,vp,fps) ((fps * CALC_PERIOD(w,hb,hf,hp) * CALC_PERIOD(h,vb,vf,vp) * 1048576 @@ -46,7 +47,7 @@ typedef struct LCD_Parameters { #define LCD_PANEL_TYPE_SERIAL_RGB_DUMMY_MODE (((1<<5) | (1<<6)) << 8) // Serial RGB+dummy } LCD_Parameters; -#include "board_SSD1963.h" +#include "gdisp_lld_board_st_stm32f4_discovery.h" /*===========================================================================*/ /* Driver local definitions. */ @@ -81,8 +82,8 @@ static inline void set_viewport(GDisplay* g) { write_data16(g, g->p.x); write_data16(g, g->p.x+g->p.cx-1); write_index(g, SSD1963_SET_PAGE_ADDRESS); - write_data16(g, g->p.y); - write_data16(g, g->p.y+g->p.cy-1); + write_data16(g, g->frame_buffer*GDISP_SCREEN_HEIGHT+g->p.y); + write_data16(g, g->frame_buffer*GDISP_SCREEN_HEIGHT+g->p.y+g->p.cy-1); write_index(g, SSD1963_WRITE_MEMORY_START); break; case GDISP_ROTATE_90: @@ -142,6 +143,12 @@ static inline void set_backlight(GDisplay *g, uint8_t percent) { write_data(g, 0x0F); // Brightness prescaler - active when Trans } + + + + + + /*===========================================================================*/ /* Driver exported functions. */ /*===========================================================================*/ @@ -230,6 +237,19 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { write_data(g, 0x00); #endif + /*write scroll aera*/ + write_index(g,SSD1963_SET_SCROLL_AREA); //set PWM for BackLight + write_data(g,( 0 >> 8) & 0xFF); //top + write_data(g,( 0 >> 0) & 0xFF); + write_data(g,( 272 >> 8) & 0xFF); //scroll + write_data(g,( 272 >> 0) & 0xFF); + write_data(g,( 0 >> 8) & 0xFF); //bottom + write_data(g,( 0 >> 0) & 0xFF); + + write_index(g,SSD1963_SET_SCROLL_START); + write_data(g,( 0 >> 8) & 0xFF); + write_data(g,( 0 >> 0) & 0xFF); + /* Tear effect indicator ON. This is used to tell the host MCU when the driver is not refreshing the panel write_reg(g, SSD1963_SET_TEAR_ON, 0x00); @@ -239,6 +259,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { /* Turn on the back-light */ set_backlight(g, GDISP_INITIAL_BACKLIGHT); + + // Finish Init post_init_board(g); @@ -246,6 +268,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { release_bus(g); /* Initialise the GDISP structure */ + g->frame_display = 0; + g->frame_buffer = 0; g->g.Width = lcdp->width; g->g.Height = lcdp->height; g->g.Orientation = GDISP_ROTATE_0; @@ -268,6 +292,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { } #endif + + #if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL LLDSPEC void gdisp_lld_control(GDisplay *g) { switch(g->p.x) { @@ -363,6 +389,23 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->g.Backlight = (unsigned)g->p.ptr; return; + case GDISP_CONTROL_FRAME: + if (g->frame_display == (unsigned)g->p.ptr) + return; + else + { + acquire_bus(g); + write_index(g,SSD1963_SET_SCROLL_START); + write_data(g,( ((unsigned)g->p.ptr * GDISP_SCREEN_HEIGHT) >> 8) & 0xFF); + write_data(g,( ((unsigned)g->p.ptr * GDISP_SCREEN_HEIGHT) >> 0) & 0xFF); + release_bus(g); + g->frame_display = (unsigned)g->p.ptr; + } + return; + + case GDISP_CONTROL_FRAME_BUFFER: + g->frame_buffer = (unsigned)g->p.ptr; + return; //case GDISP_CONTROL_CONTRAST: - see DDS1963_SET_POST_PROC command - contrast, brightness, saturati default: return; index 8d22135..42b4524 --- a/src/gdisp/driver.h +++ b/src/gdisp/driver.h @@ -237,6 +237,9 @@ struct GDisplay { uint8_t Contrast; } g; + uint8_t frame_display; + uint8_t frame_buffer; + void * priv; // A private area just for void * board; // A private area just for index f952e41..6321be0 --- a/src/gdisp/sys_defs.h +++ b/src/gdisp/sys_defs.h @@ -105,6 +105,8 @@ extern GDisplay *GDISP; #define GDISP_CONTROL_ORIENTATION 1 #define GDISP_CONTROL_BACKLIGHT 2 #define GDISP_CONTROL_CONTRAST 3 +#define GDISP_CONTROL_FRAME 4 +#define GDISP_CONTROL_FRAME_BUFFER 5 #define GDISP_CONTROL_LLD 1000 /*===========================================================================*/ @@ -1067,6 +1069,12 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co #define gdispGSetOrientation(g, newOrientation) gdispGControl((g), GDISP_CONTROL_ORIENTATION, (void #define gdispSetOrientation(newOrientation) gdispGControl(GDISP, GDISP_CONTROL_ORIENTATION, (vo +#define gdispGSetFrame(g, newFrame) gdispGControl((g), GDISP_CONTROL_FRAME, (void *)(unsigned)( +#define gdispSetFrame(newFrame) gdispGControl(GDISP, GDISP_CONTROL_FRAME, (void *)( + +#define gdispGSetFrameBuffer(g, newFrame) gdispGControl((g), GDISP_CONTROL_FRAME_BUFFER, (voi +#define gdispSetFrameBuffer(newFrame) gdispGControl(GDISP, GDISP_CONTROL_FRAME_BUFFER, (v + /** * @brief Set the display backlight. * @note Ignored if not supported by the display.