DMD - Dot Matrix Display

Description

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.

Data Structures

struct __DMD_DisplayGeometry
struct __DMD_MemoryError
struct DMD_DisplayGeometry
Dimensions of the display.
struct DMD_MemoryError
Information about a memory error.

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 DMD_wakeUp (void)
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 DMD_updateDisplay (void)
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.

Typedefs

typedef void DMD_InitConfig
Configuration parameter for DMD_init.

Function Documentation

DMD_init()

EMSTATUS DMD_init ( DMD_InitConfig * initConfig )

Initializes the DMD support for memory lcd display.

Parameters
initConfig 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
[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.

Note
All coordinates given to writeData/writeColor/readData are relative to this clipping area.
Parameters
xStart X coordinate of the upper left corner of the clipping area
yStart Y coordinate of the upper left corner of the clipping area
width Width of the clipping area
height Height of the 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
x X coordinate of the first pixel to be written, relative to the clipping area
y Y coordinate of the first pixel to be written, relative to the clipping area
data 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.
numPixels 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
x X coordinate of the first pixel to be written, relative to the clipping area
y Y coordinate of the first pixel to be written, relative to the clipping area
red Red component of the color
green Green component of the color
blue Blue component of the color
numPixels 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.

Returns
DMD_OK on success, otherwise error code

DMD_wakeUp()

EMSTATUS DMD_wakeUp ( void )

Wakes up the display from sleep mode.

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
horizontal Set to flip display horizontally
vertical 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
framebuffer 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
framebuffer 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.

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.

Macro Definition Documentation

ECODE_DMD_BASE

#define ECODE_DMD_BASE   0x00000000

Base of DMD error codes.

DMD_OK

#define DMD_OK   0x00000000

Successful call.

DMD_ERROR_DRIVER_NOT_INITIALIZED

#define DMD_ERROR_DRIVER_NOT_INITIALIZED   ( ECODE_DMD_BASE | 0x0001)

Driver not initialized correctly.

DMD_ERROR_DRIVER_ALREADY_INITIALIZED

#define DMD_ERROR_DRIVER_ALREADY_INITIALIZED   ( ECODE_DMD_BASE | 0x0002)

Driver is already initialized.

DMD_ERROR_TOO_MUCH_DATA

#define DMD_ERROR_TOO_MUCH_DATA   ( ECODE_DMD_BASE | 0x0003)

Length of data is larger than size of clip.

DMD_ERROR_PIXEL_OUT_OF_BOUNDS

#define DMD_ERROR_PIXEL_OUT_OF_BOUNDS   ( ECODE_DMD_BASE | 0x0004)

Pixel is outside current clipping area.

DMD_ERROR_EMPTY_CLIPPING_AREA

#define DMD_ERROR_EMPTY_CLIPPING_AREA   ( ECODE_DMD_BASE | 0x0005)

Clipping area is empty.

DMD_ERROR_WRONG_DEVICE_CODE

#define DMD_ERROR_WRONG_DEVICE_CODE   ( ECODE_DMD_BASE | 0x0006)

Wrong device code.

DMD_ERROR_MEMORY_ERROR

#define DMD_ERROR_MEMORY_ERROR   ( ECODE_DMD_BASE | 0x0007)

Memory error.

DMD_ERROR_NO_ERROR_CODE

#define DMD_ERROR_NO_ERROR_CODE   ( ECODE_DMD_BASE | 0x0008)

Error code expected, but didn't happen.

DMD_ERROR_TEST_FAILED

#define DMD_ERROR_TEST_FAILED   ( ECODE_DMD_BASE | 0x0009)

Test run failed.

DMD_ERROR_NOT_SUPPORTED

#define DMD_ERROR_NOT_SUPPORTED   ( ECODE_DMD_BASE | 0x000a)

Function or option not supported - yet.

DMD_ERROR_NOT_ENOUGH_MEMORY

#define DMD_ERROR_NOT_ENOUGH_MEMORY   ( ECODE_DMD_BASE | 0x000b)

Not enough memory.


DMD_TEST_DEVICE_CODE

#define DMD_TEST_DEVICE_CODE   0x00000001

Device code test.

DMD_TEST_MEMORY

#define DMD_TEST_MEMORY   0x00000002

Memory test.

DMD_TEST_PARAMETER_CHECKS

#define DMD_TEST_PARAMETER_CHECKS   0x00000004

Parameter checks test.

DMD_TEST_COLORS

#define DMD_TEST_COLORS   0x00000008

Color test.

DMD_TEST_CLIPPING

#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.