Epson Research and Development
Page 59
Vancouver Design Center
9.4 Examples
Source code demonstrating various SwivelView rotations is provided in the file
13506swivel.c available on the internet at www.eea.epson.com.
Example 7:Rotate Image 90° for a 640x480 display at a color depth of 8 bpp.
Before enabling SwivelView, the display buffer should be cleared. This makes the
transition smoother as existing display images cannot be rotated by hardware - a repaint is
necessary.
1. Set the line offset to 1024 pixels. The Memory Offset register is the offset in words.
Write 02h to REG[047h] and write 00h to REG[046h].
2. Set the LCD Display Start Address. The Display Start Address registers form a point-
er to a word, therefore the value to set the start.
Write C0h (192 or (1024 - 480)÷2) to REG[042h], REG[043h] and REG[044h]. That
is write C0h) to REG[042h], 00h to REG[043h] and 00h to REG[044h].
3. Enable SwivelView Bit 0 and clear SwivelView Bit 1. Set REG[1FCh] to 1 and
REG[040h] to 0.
4. The display is now configured for SwivelView 90° mode. Offset zero into the display
buffer corresponds to the upper left corner of the display. The only difference seen by
the programmer is the display offset is now 1024 pixels regardless of the physical
dimensions of the display.
5. Draw the desired image.
Example 8:Rotate Image 180 degrees for a 640x480 display at a color depth of 16
bpp.
Assuming the existing image is unrotated, the display buffer does not have to be cleared.
Existing display images are simply be rotated by hardware. In this case a repaint is not
necessary.
1. The Memory Offset register does not need to be modified.
2. Set the LCD Display Start Address. The Display Start Address registers form a point-
er to a word, therefore the value to set the start. Calculate the value based on the fol-
lowing formula.
StartAddress = (ScanBytes × PanelHeight - (ScanBytes - 2 × PanelWidth)) ÷ 2 - 1
= (1280 × 480 - (1280 -2 × 640)) ÷ 2 - 1
= (1280 × 480) ÷ 2 - 1
= 307199
= 4AFFFh
Programming Notes and Examples
Issue Date: 01/02/06
S1D13506
X25B-G-003-03