MEMLCD - Memory LCD

Description

Memory LCD interface.

The memory LCD interface is built to use SPI communication either with usart or eusart. Configurations for three standard display are already supported (lpm013m126a, ls013b7dh03 and ls013b7dh06), but the sl_memlcd_t structure can also be configured with a custom LCD's specifications. To implement a fully custom memory LCD interface, see Custom Memory LCD .

Note
When using the EUSART as the communication engine, care must be taken to ensure the EUSART is re-enabled when coming back from EM2/3. This is automatically handle by the Power Manager when added to a project. See EMLIB Eusart - EM2 guideline for non EM2-Capable instance


Custom Memory LCD

The custom memory LCD is a module allowing the implementation of a LCD driver that can't use the already designed interface. To achieve this, conditions must be met.

The LCD driver and the communication need to be implemented manually. However, some functions must be implemented and the sl_memlcd_t structure must be initialized for the GLIB library to work properly. The functions to implement are sl_memlcd_init , sl_memlcd_power_on , sl_memlcd_draw and sl_memlcd_get and they must follow the same declaration as shown in the documentation.

In the sl_memlcd_init function, it is important to initialize a sl_memlcd_t type variable and fill in the "height" and "width" fields with the real specifications of the LCD display. This same variable must be accessible from the sl_memlcd_get function as the GLIB library will fetch the height and width of the display.

The sl_memlcd_t structure contains a "custom_data" field to store any custom structure needed for the implementation of the driver.

Data Structures

struct sl_memlcd_t
General memory LCD data structure.

Functions

sl_status_t sl_memlcd_configure (struct sl_memlcd_t *device)
Configure the memory LCD device.
sl_status_t sl_memlcd_power_on (const struct sl_memlcd_t *device, bool on)
Enable or disable the display.
sl_status_t sl_memlcd_clear (const struct sl_memlcd_t *device)
Clear the display.
sl_status_t sl_memlcd_draw (const struct sl_memlcd_t *device, const void *data, unsigned int row_start, unsigned int row_count)
Draw a number of rows to the memory LCD display.
sl_status_t sl_memlcd_refresh (const struct sl_memlcd_t *device)
Refresh the display device.
const sl_memlcd_t * sl_memlcd_get (void)
Get a handle to the memory LCD.
sl_status_t sl_memlcd_init (void)
Initialize the memory LCD.

Function Documentation

sl_memlcd_configure()

sl_status_t sl_memlcd_configure ( struct sl_memlcd_t * device )

Configure the memory LCD device.

This function must be called to configure the memory LCD device before starting to use the memory LCD.

Parameters
[in] device Display device pointer.
Returns
status code of the operation.

sl_memlcd_power_on()

sl_status_t sl_memlcd_power_on ( const struct sl_memlcd_t * device,
bool on
)

Enable or disable the display.

This function enables or disables the display. Disabling the display does not make it lose its data. Note that this function will not control the DISP pin on the display. This pin is usually controlled by board specific code.

Parameters
[in] device Display device pointer.
[in] on Set this parameter to 'true' to enable the display. Set to 'false' in order to disable the display.
Returns
status code of the operation.

sl_memlcd_clear()

sl_status_t sl_memlcd_clear ( const struct sl_memlcd_t * device )

Clear the display.

Parameters
[in] device Memory LCD display device.
Returns
SL_STATUS_OK if there are no errors.

sl_memlcd_draw()

sl_status_t sl_memlcd_draw ( const struct sl_memlcd_t * device,
const void * data,
unsigned int row_start,
unsigned int row_count
)

Draw a number of rows to the memory LCD display.

Parameters
[in] device Memory LCD display device.
[in] data Pointer to the pixel matrix buffer to draw. The format of the buffer depends on the color mode of the memory LCD display.
[in] row_start Start row on the display where to start drawing. First row is 0.
[in] row_count Number of rows to draw.
Returns
SL_STATUS_OK if there are no errors.

sl_memlcd_refresh()

sl_status_t sl_memlcd_refresh ( const struct sl_memlcd_t * device )

Refresh the display device.

This function can be used when, for instance, the clock configuration was changed to re-initialize the SPI clock rate.

Parameters
[in] device Display device pointer.
Returns
status code of the operation.

sl_memlcd_get()

const sl_memlcd_t * sl_memlcd_get ( void )

Get a handle to the memory LCD.

Returns
Pointer to a memory LCD structure or NULL if no memory LCD is initialized yet.

sl_memlcd_init()

sl_status_t sl_memlcd_init ( void )

Initialize the memory LCD.

Returns
SL_STATUS_OK if there are no errors.