Minor improvement to the ST7565 driver

This commit is contained in:
Joel Bodenmann 2016-08-26 21:45:41 +02:00
parent 8603afd309
commit ea632d5001

View File

@ -82,6 +82,9 @@
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
// The private area is the display surface. // The private area is the display surface.
g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8); g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8);
if (!g->priv) {
return FALSE;
}
// Initialise the board interface // Initialise the board interface
init_board(g); init_board(g);
@ -127,13 +130,14 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
// Release the bus // Release the bus
release_bus(g); release_bus(g);
/* Initialise the GDISP structure */ // Initialise the GDISP structure
g->g.Width = GDISP_SCREEN_WIDTH; g->g.Width = GDISP_SCREEN_WIDTH;
g->g.Height = GDISP_SCREEN_HEIGHT; g->g.Height = GDISP_SCREEN_HEIGHT;
g->g.Orientation = GDISP_ROTATE_0; g->g.Orientation = GDISP_ROTATE_0;
g->g.Powermode = powerOn; g->g.Powermode = powerOn;
g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
g->g.Contrast = GDISP_INITIAL_CONTRAST; g->g.Contrast = GDISP_INITIAL_CONTRAST;
return TRUE; return TRUE;
} }
@ -247,7 +251,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
if (g->g.Orientation == (orientation_t)g->p.ptr) if (g->g.Orientation == (orientation_t)g->p.ptr)
return; return;
switch((orientation_t)g->p.ptr) { switch((orientation_t)g->p.ptr) {
/* Rotation is handled by the drawing routines */ // Rotation is handled by the drawing routines
case GDISP_ROTATE_0: case GDISP_ROTATE_0:
case GDISP_ROTATE_180: case GDISP_ROTATE_180:
g->g.Height = GDISP_SCREEN_HEIGHT; g->g.Height = GDISP_SCREEN_HEIGHT;