DMD - Dot Matrix Display#

Hardware abstraction layer for dot matrix displays.

The DMD interface is the hardware abstraction layer for a physical display. The DMD interface provides functions for treating a connected display as a matrix of pixels of a specific size. The DMD provides functions for initializing the display hardware interface by calling DMD_init() and writing pixel data to the display by calling the function DMD_writeData().

DMD Drivers#

GLIB provides a DMD driver for the Sharp Memory LCD screens used on the Silicon Labs Starter Kits. This driver must be used together with the kit display drivers.

Modules#

DMD_DisplayGeometry

DMD_MemoryError

Typedefs#

typedef void

Configuration parameter for DMD_init.

Functions#

EMSTATUS
DMD_init(DMD_InitConfig *initConfig)

Initializes the DMD support for memory lcd display.

EMSTATUS
DMD_getDisplayGeometry(DMD_DisplayGeometry **geometry)

Get the dimensions of the display and of the current clipping area.

EMSTATUS
DMD_setClippingArea(uint16_t xStart, uint16_t yStart, uint16_t width, uint16_t height)

Sets the current clipping area.

EMSTATUS
DMD_writeData(uint16_t x, uint16_t y, const uint8_t data[], uint32_t numPixels)

Draws pixels to the display.

EMSTATUS
DMD_writeColor(uint16_t x, uint16_t y, uint8_t red, uint8_t green, uint8_t blue, uint32_t numPixels)

Draws a number of pixels of the same color to the display.

EMSTATUS
DMD_sleep(void)

Turns off the display and puts it into sleep mode Does not turn off backlight.

EMSTATUS

Wakes up the display from sleep mode.

EMSTATUS
DMD_flipDisplay(int horizontal, int vertical)

Set horizontal and vertical flip mode of display controller.

EMSTATUS
DMD_selectFramebuffer(void *framebuffer)

Select the active framebuffer DMD functions will draw in.

EMSTATUS
DMD_getFrameBuffer(void **framebuffer)

Get current framebuffer used by DMD for drawing (backbuffer).

EMSTATUS

Update the display device with contents of active framebuffer.

Macros#

#define
ECODE_DMD_BASE 0x00000000

Base of DMD error codes.

#define
DMD_OK 0x00000000

Successful call.

#define
DMD_ERROR_DRIVER_NOT_INITIALIZED (ECODE_DMD_BASE | 0x0001)

Driver not initialized correctly.

#define
DMD_ERROR_DRIVER_ALREADY_INITIALIZED (ECODE_DMD_BASE | 0x0002)

Driver is already initialized.

#define
DMD_ERROR_TOO_MUCH_DATA (ECODE_DMD_BASE | 0x0003)

Length of data is larger than size of clip.

#define
DMD_ERROR_PIXEL_OUT_OF_BOUNDS (ECODE_DMD_BASE | 0x0004)

Pixel is outside current clipping area.

#define
DMD_ERROR_EMPTY_CLIPPING_AREA (ECODE_DMD_BASE | 0x0005)

Clipping area is empty.

#define
DMD_ERROR_WRONG_DEVICE_CODE (ECODE_DMD_BASE | 0x0006)

Wrong device code.

#define
DMD_ERROR_MEMORY_ERROR (ECODE_DMD_BASE | 0x0007)

Memory error.

#define
DMD_ERROR_NO_ERROR_CODE (ECODE_DMD_BASE | 0x0008)

Error code expected, but didn't happen.

#define
DMD_ERROR_TEST_FAILED (ECODE_DMD_BASE | 0x0009)

Test run failed.

#define
DMD_ERROR_NOT_SUPPORTED (ECODE_DMD_BASE | 0x000a)

Function or option not supported - yet.

#define
DMD_ERROR_NOT_ENOUGH_MEMORY (ECODE_DMD_BASE | 0x000b)

Not enough memory.

#define
DMD_TEST_DEVICE_CODE 0x00000001

Device code test.

#define
DMD_TEST_MEMORY 0x00000002

Memory test.

#define
DMD_TEST_PARAMETER_CHECKS 0x00000004

Parameter checks test.

#define
DMD_TEST_COLORS 0x00000008

Color test.

#define
DMD_TEST_CLIPPING 0x00000010

Clipping test.

Typedef Documentation#

DMD_InitConfig#

typedef void DMD_InitConfig

Configuration parameter for DMD_init.

This typedef is defined 'void' and may be defined differently in the future.


Function Documentation#

DMD_init#

EMSTATUS DMD_init (DMD_InitConfig * initConfig)

Initializes the DMD support for memory lcd display.

Parameters
TypeDirectionArgument NameDescription
DMD_InitConfig *N/AinitConfig

Not used in this DMD module.

Returns

  • DMD_OK on success, otherwise error code


DMD_getDisplayGeometry#

EMSTATUS DMD_getDisplayGeometry (DMD_DisplayGeometry ** geometry)

Get the dimensions of the display and of the current clipping area.

Parameters
TypeDirectionArgument NameDescription
DMD_DisplayGeometry **[out]geometry

Geometry structure

Returns

  • DMD_OK on success, otherwise error code


DMD_setClippingArea#

EMSTATUS DMD_setClippingArea (uint16_t xStart, uint16_t yStart, uint16_t width, uint16_t height)

Sets the current clipping area.

Parameters
TypeDirectionArgument NameDescription
uint16_tN/AxStart

X coordinate of the upper left corner of the clipping area

uint16_tN/AyStart

Y coordinate of the upper left corner of the clipping area

uint16_tN/Awidth

Width of the clipping area

uint16_tN/Aheight

Height of the clipping area

Note

  • All coordinates given to writeData/writeColor/readData are relative to this clipping area.

Returns

  • DMD_OK on success, otherwise error code


DMD_writeData#

EMSTATUS DMD_writeData (uint16_t x, uint16_t y, const uint8_t data, uint32_t numPixels)

Draws pixels to the display.

Parameters
TypeDirectionArgument NameDescription
uint16_tN/Ax

X coordinate of the first pixel to be written, relative to the clipping area

uint16_tN/Ay

Y coordinate of the first pixel to be written, relative to the clipping area

const uint8_tN/Adata

Array containing the pixel data. For monochrome displays, each 8-bit element contains 8 pixels values. For RGB displays, each bit in the array are one color component of the pixel, so that 3 bits represent one pixel. The pixels are ordered by increasing x coordinate, after the last pixel of a row, the next pixel will be the first pixel on the next row.

uint32_tN/AnumPixels

Number of pixels to be written

Returns

  • DMD_OK on success, otherwise error code


DMD_writeColor#

EMSTATUS DMD_writeColor (uint16_t x, uint16_t y, uint8_t red, uint8_t green, uint8_t blue, uint32_t numPixels)

Draws a number of pixels of the same color to the display.

Parameters
TypeDirectionArgument NameDescription
uint16_tN/Ax

X coordinate of the first pixel to be written, relative to the clipping area

uint16_tN/Ay

Y coordinate of the first pixel to be written, relative to the clipping area

uint8_tN/Ared

Red component of the color

uint8_tN/Agreen

Green component of the color

uint8_tN/Ablue

Blue component of the color

uint32_tN/AnumPixels

Number of pixels to be written

Returns

  • DMD_OK on success, otherwise error code


DMD_sleep#

EMSTATUS DMD_sleep (void )

Turns off the display and puts it into sleep mode Does not turn off backlight.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • DMD_OK on success, otherwise error code


DMD_wakeUp#

EMSTATUS DMD_wakeUp (void )

Wakes up the display from sleep mode.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Returns

  • DMD_OK on success, otherwise error code


DMD_flipDisplay#

EMSTATUS DMD_flipDisplay (int horizontal, int vertical)

Set horizontal and vertical flip mode of display controller.

Parameters
TypeDirectionArgument NameDescription
intN/Ahorizontal

Set to flip display horizontally

intN/Avertical

Set to flip display vertically

Returns

  • Returns DMD_OK if successful, error otherwise.


DMD_selectFramebuffer#

EMSTATUS DMD_selectFramebuffer (void * framebuffer)

Select the active framebuffer DMD functions will draw in.

Parameters
TypeDirectionArgument NameDescription
void *N/Aframebuffer

Pointer to the framebuffer to be selected as active framebuffer.

Returns

  • Returns DMD_OK if successful, error otherwise.


DMD_getFrameBuffer#

EMSTATUS DMD_getFrameBuffer (void ** framebuffer)

Get current framebuffer used by DMD for drawing (backbuffer).

Parameters
TypeDirectionArgument NameDescription
void **N/Aframebuffer

Pointer to a framebuffer array. Gets set to DMD's current buffer.

Returns

  • DMD_OK on success


DMD_updateDisplay#

EMSTATUS DMD_updateDisplay (void )

Update the display device with contents of active framebuffer.

Parameters
TypeDirectionArgument NameDescription
voidN/A

Only the dirty rows/lines are updated on the display device. Dirty rows/lines are those that have been written to since the last display update. When a new active framebuffer is selected, all lines/rows will be marked as dirty.

Returns

  • Returns DMD_OK if successful, error otherwise.