2.1 Display Specific Drivers

The display specific drivers provides an interface to the graphical display. It implements the low-level communication with the display hardware, putting pixels on the display and drawing primitives such as lines, circles, and rectangles. Depending on the display driver implementation, drawing the graphics primitives might be handled by the generic graphics drawing primitives rather than the display driver itself.

In this example, the display specific drivers are implemented in gfx_mono_ug_2832hsweg04.h and gfx_mono_ug_2832hsweg04.c.

The driver functions are listed below:

Table 2-1. Display Specific Driver Functions
FunctionsDescription
gfx_mono_ssd1306_draw_pixel()Draw pixel to screen
gfx_mono_ssd1306_get_byte()Get a byte from the display controller RAM
gfx_mono_ssd1306_get_page()Read a page from the LCD controller
gfx_mono_ssd1306_get_pixel()Get the pixel value at x,y
gfx_mono_ssd1306_init()Initialize the SSD1306 controller and LCD display
gfx_mono_ssd1306_mask_byte()Read/Modify/Write a byte on the display controller
gfx_mono_ssd1306_put_byte()Put a byte to the display controller RAM
gfx_mono_ssd1306_put_framebuffer()Put frame-buffer to the LCD controller
gfx_mono_ssd1306_put_page()Put a page from RAM to the display controller
In gfx_mono_ug_2832hsweg04.h, there are a abstraction layer definition by macros, like:
#define gfx_mono_put_byte(page, column, data) \
	gfx_mono_ssd1306_put_byte(page, column, data, false)

#define gfx_mono_get_byte(page, column)	\
	gfx_mono_ssd1306_get_byte(page, column)

They are the interface to the GFX library.

The low-level display driver is located at ASF\common\components\display\ssd1306.h/c, the SPI communication with OLED specific commands are handled here. The display specific drivers mentioned above will finally call the low-level drivers to access the OLED controller.

To use GFX library on a new display device, low-level display drivers should be changed accordingly.