Browse Source

Minor improvement to the ST7565 driver

Joel Bodenmann 3 years ago
parent
commit
ea632d5001
1 changed files with 6 additions and 2 deletions
  1. 6 2
      drivers/gdisp/ST7565/gdisp_lld_ST7565.c

+ 6 - 2
drivers/gdisp/ST7565/gdisp_lld_ST7565.c

@@ -82,6 +82,9 @@
82 82
 LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
83 83
 	// The private area is the display surface.
84 84
 	g->priv = gfxAlloc(GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8);
85
+	if (!g->priv) {
86
+		return FALSE;
87
+	}
85 88
 
86 89
 	// Initialise the board interface
87 90
 	init_board(g);
@@ -127,13 +130,14 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
127 130
  	// Release the bus
128 131
 	release_bus(g);
129 132
 
130
-	/* Initialise the GDISP structure */
133
+	// Initialise the GDISP structure
131 134
 	g->g.Width = GDISP_SCREEN_WIDTH;
132 135
 	g->g.Height = GDISP_SCREEN_HEIGHT;
133 136
 	g->g.Orientation = GDISP_ROTATE_0;
134 137
 	g->g.Powermode = powerOn;
135 138
 	g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
136 139
 	g->g.Contrast = GDISP_INITIAL_CONTRAST;
140
+
137 141
 	return TRUE;
138 142
 }
139 143
 
@@ -247,7 +251,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
247 251
 			if (g->g.Orientation == (orientation_t)g->p.ptr)
248 252
 				return;
249 253
 			switch((orientation_t)g->p.ptr) {
250
-			/* Rotation is handled by the drawing routines */
254
+			// Rotation is handled by the drawing routines
251 255
 			case GDISP_ROTATE_0:
252 256
 			case GDISP_ROTATE_180:
253 257
 				g->g.Height = GDISP_SCREEN_HEIGHT;