|
Using
a Graphics-Based LCD
Module with C
by Bob Perrin and Tak Auyeung
Start ý Software
Overview ý The Bottom Layer ý Initializing
the LCD Display ý Shadow Display ý
Drawing Dots and Lines ý Printing
Text ý Extensions ý Sources
and PDF
SHADOW DISPLAY
Because the clocked-serial interface
doesnýt allow the display data to be read, it is important to maintain
a shadow copy of the display data on the controller. It is equally
important to maintain shadow copies of LCD controller registers so
that the correct byte in the shadow display data buffer can be updated.
The structure (struct _scrBuffer) contains all the shadowed
state information. The functions scrPageAddressSet, scrColumnAddressSet,
and scrDisplayDataWrite mimic the LCD macros, but the scr
functions also update a struct _scrBuffer structure, in addition
to sending commands to the Hantronix HDG12864F-1.
Currently, all scr operations
except scrVirtualDisplayWrite send commands to the LCD module
to keep the LCD and shadowed state synchronized. For efficiency, however,
the reader may extend some of the functions to update only the shadowed
state and implement another function to update the entire or part
of the actual LCD display data. This is more efficient for drawing
a long sequence of graphics primitive operations.
BRUSH TYPES
Instead of overwriting a display pixel,
some applications may need to combine new graphics constructs with
existing pixels on the LCD. The driver supports four methods (brush
types) to combine new pixels with existing pixels. The current brush
type is specified by the function scrSetBrush with one of the
following constants (newPix is the new pixel, oldPix
is the current display pixel value, and pix is the combined
pixel value to update the LCD):
ý SCR_BRUSH_SET: pix = oldPix |
newPix
ý SCR_BRUSH_CLR: pix = oldPix &
(~newPix)
ý SCR_BRUSH_XOR: pix = oldPix ^
newPix
ý SCR_BRUSH_OVR: pix = newPix
The brush type is applicable to all drawing
primitives.
PREVIOUS
NEXT
Circuit Cellar provides up-to-date information
for engineers. Visit www.circuitcellar.com
for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe
online. ýCircuit Cellar, the Magazine for Computer Applications.
Posted with permission.
|