■ FIGURE 5. The
Graphics library
operation.
■ FIGURE 6. Text display.
■ FIGURE 7. FONT display.
When writing text, the library makes use of a font
array that is organized as 8 x 8 pixels for each character
that is drawn in VMAP. The font supports all printable
characters, numbers, and special characters like quotes,
commas, etc. Likewise, when drawing bit images or icons
the library uses the available bit images that have been
included within the project as “bitmap.h“ files. These must
include a “# include” directive for each bit image in the
34 April 2010
MAIN code. It is recommended to look at the
GRAPHICDEMO project to get a better idea of how this
works. There are a large number of bit images already
provided.
Display Initialization and Refresh
Using the Library
There are several library functions that are used to
initialize the display, clear it on demand, and dump or
“refresh” the contents of VMAP onto the display for
presentation.
•initSD () — Initializes the SPI port to communicate to
the display, initializes the display for graphics, and clears it
of any random pixel content (display comes up blank).
•clearScreen () — Clears the VMAP memory first and
then dumps these contents onto the display. Use this to
begin any new display screen presentation.
•dumpVmap () — Dumps the current contents of
VMAP onto the display. The idea is once the screen is
finished in VMAP, it transfers it to the display for user
presentation. This function performs that operation.
Outputting Text Using the Library
Outputting text is really simple. An important rule to
remember is to position the cursor to a legitimate
character position prior to outputting text. Let’s discuss
“legitimate” character positions. Since the library uses an 8
x 8 bit font for each character and the display has 128 x
64 pixels, there is a total character display capability of 16
columns by eight rows of character text. The library
accepts a column value (x between 0-15) and row value (y
between 0-7) for text placement. Let’s review some
important functions and give some examples. Keep in
mind that the 0,0 cursor position is the top lefthand
corner of the display.
•AT (x, y) — Position character cursor to x, y position
of VMAP.
•putsV (string) — Outputs the string starting at the
current character position. If the string length extends
beyond the maximum column, the text wraps around to
the next row.
Figure 6 is a code example for the Random Line
Display. A more challenging example that displays the
entire available character font in the library on one screen
is shown in Figure 7.
Outputting Bitmaps Using
the Library
Outputting bitmaps is as easy as outputting text using
the library. A bitmap at 32 x 32 pixels is just a large font
(remember our fonts are 8 x 8). A particular bitmap has to