THE DESIGN CYCLE
So far, we have managed to awaken our
FT800 and post some words and a button
on the screen. We still have some unfinished
business to settle. We also have some
Post comments on this article and find any associated
files and/or downloads at www.nutsvolts.com/index.
■ BY FRED EADY
additional exploring to do. With that, let's
The FT800 Graphics Engine operates within a 4 KB
ring buffer which begins at address 0x108000. The
location 0x108000 is identified as RAM_CMD in the
I left you with the code that produced the output you
see in Photo 1. In Ricky Ricardo’s world, I now have some
“splaining” to do.
Ring buffers operate by moving data around using
head and tail pointers. The Graphics Engine is no different.
However, instead of heads and tails, the Graphics Engine
uses values stored in REG_CMD_WRITE and
REG_CMD_READ. When REG_CMD_WRITE is equal to
REG_CMD_READ, the ring buffer is idle. As commands
are written to the ring buffer, REG_CMD_WRITE is
incremented. The Graphics Engine detects the difference
between REG_CMD_WRITE and REG_CMD_READ, and
processes the commands while simultaneously
■ Photo 1. That OK button is just begging to be touched.
However, we haven't climbed high enough on the
mountain of EVE knowledge to make that happen just yet.
Once the FT800 is initialized, the host microcontroller
has the ability to manipulate the FT800 under application
control. The FT800 wants to see Display Lists. A Display
When REG_CMD_READ catches up to the value of
REG_CMD_WRITE, the ring buffer goes back to the idle
state. Thus, the ring buffer stop point is defined as the
value of REG_CMD_READ, while the starting point is
defined as the value of REG_CMD_WRITE. The ring buffer
pointers are easily manipulated using the rd32 function we
List is made up of basic graphic primitives such as points,
lines, and bitmaps. Display Lists are swapped in and out to
interface with the human finger pointer. A selected
unsigned int cmdBufRd,cmdBufWr;
unsigned short cmdOffset;
Display List is shown while the next one is being
constructed. A Display List always begins with a clear
screen operation and ends with a swap. Thus, changes to
the display are the result of multiple Display List swaps
that are dictated by the application.
cmdBufRd = rd32(REG_CMD_READ);
//get Graphics Engine stop point
cmdBufWr = rd32(REG_CMD_WRITE);
//get Graphics Engine start point
cmdOffset = cmdBufWr;
//store the ring buffer start offset
Drawing stuff with lines and points can be a tedious
undertaking. To make display construction a bit easier, the
FT800 supports widgets through its Graphics Engine.
Widgets are lines, points, and bitmaps that are combined
to form buttons, gauges, and text.
Note that we assigned a value to the variable
cmdOffset without checking the ring buffer for an
overflow condition. In this case, we won’t be writing
enough Display List data to remotely approach the
4092-byte ring buffer maximum size. When writing
multiple Display Lists, we must calculate the ring buffer
free space. Here’s the free space calculation code:
18 August 2014