From ea632d50012c2a65b54792167474bd8d4e6cf0bf Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Fri, 26 Aug 2016 21:45:41 +0200 Subject: [PATCH] Minor improvement to the ST7565 driver --- drivers/gdisp/ST7565/gdisp_lld_ST7565.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gdisp/ST7565/gdisp_lld_ST7565.c b/drivers/gdisp/ST7565/gdisp_lld_ST7565.c index 9ab46b57..fff1a37a 100644 --- a/drivers/gdisp/ST7565/gdisp_lld_ST7565.c +++ b/drivers/gdisp/ST7565/gdisp_lld_ST7565.c @@ -82,6 +82,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { // The private area is the display surface. g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8); + if (!g->priv) { + return FALSE; + } // Initialise the board interface init_board(g); @@ -127,13 +130,14 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { // Release the bus release_bus(g); - /* Initialise the GDISP structure */ + // Initialise the GDISP structure g->g.Width = GDISP_SCREEN_WIDTH; g->g.Height = GDISP_SCREEN_HEIGHT; g->g.Orientation = GDISP_ROTATE_0; g->g.Powermode = powerOn; g->g.Backlight = GDISP_INITIAL_BACKLIGHT; g->g.Contrast = GDISP_INITIAL_CONTRAST; + return TRUE; } @@ -247,7 +251,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { if (g->g.Orientation == (orientation_t)g->p.ptr) return; 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_180: g->g.Height = GDISP_SCREEN_HEIGHT;