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

Device code test.

#define
DMD_TEST_MEMORY 0x00000002

Memory test.

#define

Parameter checks test.

#define
DMD_TEST_COLORS 0x00000008

Color test.

#define

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.


Definition at line 114 of file platform/middleware/glib/dmd/dmd.h

Function Documentation#

DMD_init#

EMSTATUS DMD_init (DMD_InitConfig *initConfig)

Initializes the DMD support for memory lcd display.

Parameters
N/AinitConfig

Not used in this DMD module.

Returns

  • DMD_OK on success, otherwise error code


Definition at line 158 of file platform/middleware/glib/dmd/dmd.h

DMD_getDisplayGeometry#

EMSTATUS DMD_getDisplayGeometry (DMD_DisplayGeometry **geometry)

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

Parameters
[out]geometry

Geometry structure

Returns

  • DMD_OK on success, otherwise error code


Definition at line 170 of file platform/middleware/glib/dmd/dmd.h

DMD_setClippingArea#

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

Sets the current clipping area.

Parameters
N/AxStart

X coordinate of the upper left corner of the clipping area

N/AyStart

Y coordinate of the upper left corner of the clipping area

N/Awidth

Width of the clipping area

N/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


Definition at line 195 of file platform/middleware/glib/dmd/dmd.h

DMD_writeData#

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

Draws pixels to the display.

Parameters
N/Ax

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

N/Ay

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

N/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.

N/AnumPixels

Number of pixels to be written

Returns

  • DMD_OK on success, otherwise error code


Definition at line 222 of file platform/middleware/glib/dmd/dmd.h

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
N/Ax

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

N/Ay

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

N/Ared

Red component of the color

N/Agreen

Green component of the color

N/Ablue

Blue component of the color

N/AnumPixels

Number of pixels to be written

Returns

  • DMD_OK on success, otherwise error code


Definition at line 260 of file platform/middleware/glib/dmd/dmd.h

DMD_sleep#

EMSTATUS DMD_sleep (void)

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

Parameters
N/A

Returns

  • DMD_OK on success, otherwise error code


Definition at line 271 of file platform/middleware/glib/dmd/dmd.h

DMD_wakeUp#

EMSTATUS DMD_wakeUp (void)

Wakes up the display from sleep mode.

Parameters
N/A

Returns

  • DMD_OK on success, otherwise error code


Definition at line 280 of file platform/middleware/glib/dmd/dmd.h

DMD_flipDisplay#

EMSTATUS DMD_flipDisplay (int horizontal, int vertical)

Set horizontal and vertical flip mode of display controller.

Parameters
N/Ahorizontal

Set to flip display horizontally

N/Avertical

Set to flip display vertically

Returns

  • Returns DMD_OK if successful, error otherwise.


Definition at line 295 of file platform/middleware/glib/dmd/dmd.h

DMD_selectFramebuffer#

EMSTATUS DMD_selectFramebuffer (void *framebuffer)

Select the active framebuffer DMD functions will draw in.

Parameters
N/Aframebuffer

Pointer to the framebuffer to be selected as active framebuffer.

Returns

  • Returns DMD_OK if successful, error otherwise.


Definition at line 307 of file platform/middleware/glib/dmd/dmd.h

DMD_getFrameBuffer#

EMSTATUS DMD_getFrameBuffer (void **framebuffer)

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

Parameters
N/Aframebuffer

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

Returns

  • DMD_OK on success


Definition at line 320 of file platform/middleware/glib/dmd/dmd.h

DMD_updateDisplay#

EMSTATUS DMD_updateDisplay (void)

Update the display device with contents of active framebuffer.

Parameters
N/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.


Definition at line 334 of file platform/middleware/glib/dmd/dmd.h

Macro Definition Documentation#

ECODE_DMD_BASE#

#define ECODE_DMD_BASE
Value:
0x00000000

Base of DMD error codes.


Definition at line 67 of file platform/middleware/glib/dmd/dmd.h

DMD_OK#

#define DMD_OK
Value:
0x00000000

Successful call.


Definition at line 71 of file platform/middleware/glib/dmd/dmd.h

DMD_ERROR_DRIVER_NOT_INITIALIZED#

#define DMD_ERROR_DRIVER_NOT_INITIALIZED
Value:
(ECODE_DMD_BASE | 0x0001)

Driver not initialized correctly.


Definition at line 73 of file platform/middleware/glib/dmd/dmd.h

DMD_ERROR_DRIVER_ALREADY_INITIALIZED#

#define DMD_ERROR_DRIVER_ALREADY_INITIALIZED
Value:
(ECODE_DMD_BASE | 0x0002)

Driver is already initialized.


Definition at line 75 of file platform/middleware/glib/dmd/dmd.h

DMD_ERROR_TOO_MUCH_DATA#

#define DMD_ERROR_TOO_MUCH_DATA
Value:
(ECODE_DMD_BASE | 0x0003)

Length of data is larger than size of clip.


Definition at line 77 of file platform/middleware/glib/dmd/dmd.h

DMD_ERROR_PIXEL_OUT_OF_BOUNDS#

#define DMD_ERROR_PIXEL_OUT_OF_BOUNDS
Value:
(ECODE_DMD_BASE | 0x0004)

Pixel is outside current clipping area.


Definition at line 79 of file platform/middleware/glib/dmd/dmd.h

DMD_ERROR_EMPTY_CLIPPING_AREA#

#define DMD_ERROR_EMPTY_CLIPPING_AREA
Value:
(ECODE_DMD_BASE | 0x0005)

Clipping area is empty.


Definition at line 81 of file platform/middleware/glib/dmd/dmd.h

DMD_ERROR_WRONG_DEVICE_CODE#

#define DMD_ERROR_WRONG_DEVICE_CODE
Value:
(ECODE_DMD_BASE | 0x0006)

Wrong device code.


Definition at line 83 of file platform/middleware/glib/dmd/dmd.h

DMD_ERROR_MEMORY_ERROR#

#define DMD_ERROR_MEMORY_ERROR
Value:
(ECODE_DMD_BASE | 0x0007)

Memory error.


Definition at line 85 of file platform/middleware/glib/dmd/dmd.h

DMD_ERROR_NO_ERROR_CODE#

#define DMD_ERROR_NO_ERROR_CODE
Value:
(ECODE_DMD_BASE | 0x0008)

Error code expected, but didn't happen.


Definition at line 87 of file platform/middleware/glib/dmd/dmd.h

DMD_ERROR_TEST_FAILED#

#define DMD_ERROR_TEST_FAILED
Value:
(ECODE_DMD_BASE | 0x0009)

Test run failed.


Definition at line 89 of file platform/middleware/glib/dmd/dmd.h

DMD_ERROR_NOT_SUPPORTED#

#define DMD_ERROR_NOT_SUPPORTED
Value:
(ECODE_DMD_BASE | 0x000a)

Function or option not supported - yet.


Definition at line 91 of file platform/middleware/glib/dmd/dmd.h

DMD_ERROR_NOT_ENOUGH_MEMORY#

#define DMD_ERROR_NOT_ENOUGH_MEMORY
Value:
(ECODE_DMD_BASE | 0x000b)

Not enough memory.


Definition at line 93 of file platform/middleware/glib/dmd/dmd.h

DMD_TEST_DEVICE_CODE#

#define DMD_TEST_DEVICE_CODE
Value:
0x00000001

Device code test.


Definition at line 97 of file platform/middleware/glib/dmd/dmd.h

DMD_TEST_MEMORY#

#define DMD_TEST_MEMORY
Value:
0x00000002

Memory test.


Definition at line 99 of file platform/middleware/glib/dmd/dmd.h

DMD_TEST_PARAMETER_CHECKS#

#define DMD_TEST_PARAMETER_CHECKS
Value:
0x00000004

Parameter checks test.


Definition at line 101 of file platform/middleware/glib/dmd/dmd.h

DMD_TEST_COLORS#

#define DMD_TEST_COLORS
Value:
0x00000008

Color test.


Definition at line 103 of file platform/middleware/glib/dmd/dmd.h

DMD_TEST_CLIPPING#

#define DMD_TEST_CLIPPING
Value:
0x00000010

Clipping test.


Definition at line 105 of file platform/middleware/glib/dmd/dmd.h