Hexley Ball / RA8875_fork

Fork of RA8875 by David Smart

Embed: (wiki syntax)

« Back to documentation index

RA8875 Class Reference

This is a graphics library for the Raio RA8875 Display Controller chip attached to a 4-wire SPI interface. More...

#include <RA8875.h>

Inherits GraphicsDisplay.

Public Types

enum  font_t { ISO8859_1, ISO8859_2, ISO8859_3, ISO8859_4 }
 

font type selection.

More...
enum  font_angle_t { normal, rotated }
 

font rotation selection

More...
enum  alignment_t { align_none, align_full }
 

alignment

More...
enum  Region_t { FULLWINDOW, ACTIVEWINDOW }
 

Clear screen region.

More...
typedef int HorizontalScale
 Scale factor - 1, 2, 3 4.
typedef int VerticalScale
 Scale factor - 1, 2, 3, 4.

Public Member Functions

 RA8875 (PinName mosi, PinName miso, PinName sclk, PinName csel, PinName reset, const char *name="lcd")
 Constructor for a display based on the RAiO RA8875 display controller.
RetCode_t SelectLayer (uint16_t layer)
 Select the layer for subsequent commands.
RetCode_t SetLayerMode (uint8_t mode)
 Set the Layer presentation mode.
RetCode_t SetLayerTransparency (uint8_t layer1, uint8_t layer2)
 Set the layer transparency for each layer.
RetCode_t WriteCommandW (uint8_t command, uint16_t data)
 Write a command to the display with a word of data.
virtual RetCode_t WriteCommand (unsigned char command, unsigned int data=0xFFFF)
 Write a command to the display.
RetCode_t WriteDataW (uint16_t data)
 Write a data word to the display.
virtual RetCode_t WriteData (unsigned char data)
 Write a data byte to the display.
unsigned char ReadCommand (unsigned char command)
 Read a command register.
unsigned char ReadData (void)
 Read a data byte from the display.
uint16_t ReadDataW (void)
 Read a word from the display.
unsigned char ReadStatus (void)
 Read the display status.
dim_t fontwidth (void)
 get the width in pixels of the currently active font
dim_t fontheight (void)
 get the height in pixels of the currently active font
virtual int columns (void)
 get the number of colums based on the currently active font
virtual int rows (void)
 get the number of rows based on the currently active font
virtual dim_t width (void)
 get the screen width in pixels
virtual dim_t height (void)
 get the screen height in pixels
virtual dim_t color_bpp (void)
 get the color depth in bits per pixel.
virtual RetCode_t locate (textloc_t column, textloc_t row)
 Set cursor position based on the current font size.
RetCode_t SetTextCursor (loc_t x, loc_t y)
 Prepare the controller to write text to the screen by positioning the cursor.
point_t GetTextCursor (void)
 Get the current cursor position in pixels.
loc_t GetTextCursor_X (void)
 Get the current cursor horizontal position in pixels.
loc_t GetTextCursor_Y (void)
 Get the current cursor vertical position in pixels.
RetCode_t SetTextCursorControl (cursor_t cursor=NOCURSOR, bool blink=false)
 Configure additional Cursor Control settings.
RetCode_t SetTextFont (font_t font=ISO8859_1)
 Select the ISO 8859-X font to use next.
RetCode_t SetTextFontControl (fill_t fillit=FILL, font_angle_t angle=normal, HorizontalScale hScale=1, VerticalScale vScale=1, alignment_t alignment=align_none)
 Control the font behavior.
RetCode_t SetTextFontSize (HorizontalScale hScale=1, VerticalScale vScale=-1)
 Control the font size.
virtual int _putc (int c)
 put a character on the screen.
void puts (const char *string)
 Write string of text to the display.
void puts (loc_t x, loc_t y, const char *string)
 Write string of text to the display at the specified location.
virtual RetCode_t SetGraphicsCursor (loc_t x, loc_t y)
 Prepare the controller to write binary data to the screen by positioning the memory cursor.
virtual RetCode_t SetGraphicsCursorRead (loc_t x, loc_t y)
 Prepare the controller to read binary data from the screen by positioning the memory read cursor.
virtual RetCode_t window (loc_t x, loc_t y, dim_t width, dim_t height)
 Set the window, which controls where items are written to the screen.
virtual RetCode_t cls (void)
 Clear the screen.
RetCode_t clsw (RA8875::Region_t region=FULLWINDOW)
 Clear the screen, or clear only the active window.
virtual RetCode_t background (color_t color)
 Set the background color.
virtual RetCode_t background (unsigned char r, unsigned char g, unsigned char b)
 Set the background color.
virtual RetCode_t foreground (color_t color)
 Set the foreground color.
virtual RetCode_t foreground (unsigned char r, unsigned char g, unsigned char b)
 Set the foreground color.
color_t GetForeColor (void)
 Get the current foreground color value.
virtual RetCode_t pixel (loc_t x, loc_t y, color_t color)
 Draw a pixel in the specified color.
virtual RetCode_t pixel (loc_t x, loc_t y)
 Draw a pixel in the current foreground color.
virtual color_t getPixel (loc_t x, loc_t y)
 Get a pixel from the display.
virtual RetCode_t pixelStream (color_t *p, uint32_t count, loc_t x, loc_t y)
 Write a stream of pixels to the display.
virtual RetCode_t getPixelStream (color_t *p, uint32_t count, loc_t x, loc_t y)
 Get a stream of pixels from the display.
RetCode_t line (loc_t x1, loc_t y1, loc_t x2, loc_t y2, color_t color)
 Draw a line in the specified color.
RetCode_t line (loc_t x1, loc_t y1, loc_t x2, loc_t y2)
 Draw a line.
RetCode_t rect (loc_t x1, loc_t y1, loc_t x2, loc_t y2, color_t color, fill_t fillit=NOFILL)
 Draw a rectangle in the specified color.
virtual RetCode_t fillrect (loc_t x1, loc_t y1, loc_t x2, loc_t y2, color_t color, fill_t fillit=FILL)
 Draw a filled rectangle in the specified color.
RetCode_t rect (loc_t x1, loc_t y1, loc_t x2, loc_t y2, fill_t fillit=NOFILL)
 Draw a rectangle.
RetCode_t fillroundrect (loc_t x1, loc_t y1, loc_t x2, loc_t y2, dim_t radius1, dim_t radius2, color_t color, fill_t fillit=FILL)
 Draw a filled rectangle with rounded corners using the specified color.
RetCode_t roundrect (loc_t x1, loc_t y1, loc_t x2, loc_t y2, dim_t radius1, dim_t radius2, color_t color, fill_t fillit=NOFILL)
 Draw a rectangle with rounded corners using the specified color.
RetCode_t roundrect (loc_t x1, loc_t y1, loc_t x2, loc_t y2, dim_t radius1, dim_t radius2, fill_t fillit=NOFILL)
 Draw a rectangle with rounded corners.
RetCode_t triangle (loc_t x1, loc_t y1, loc_t x2, loc_t y2, loc_t x3, loc_t y3, color_t color, fill_t fillit=NOFILL)
 Draw a triangle in the specified color.
RetCode_t filltriangle (loc_t x1, loc_t y1, loc_t x2, loc_t y2, loc_t x3, loc_t y3, color_t color, fill_t fillit=FILL)
 Draw a filled triangle in the specified color.
RetCode_t triangle (loc_t x1, loc_t y1, loc_t x2, loc_t y2, loc_t x3, loc_t y3, fill_t fillit=NOFILL)
 Draw a triangle.
RetCode_t circle (loc_t x, loc_t y, dim_t radius, color_t color, fill_t fillit=NOFILL)
 Draw a circle using the specified color.
RetCode_t fillcircle (loc_t x, loc_t y, dim_t radius, color_t color, fill_t fillit=FILL)
 Draw a filled circle using the specified color.
RetCode_t circle (loc_t x, loc_t y, dim_t radius, fill_t fillit=NOFILL)
 Draw a circle.
RetCode_t ellipse (loc_t x, loc_t y, dim_t radius1, dim_t radius2, color_t color, fill_t fillit=NOFILL)
 Draw an Ellipse using the specified color.
RetCode_t fillellipse (loc_t x, loc_t y, dim_t radius1, dim_t radius2, color_t color, fill_t fillit=FILL)
 Draw a filled Ellipse using the specified color.
RetCode_t ellipse (loc_t x, loc_t y, dim_t radius1, dim_t radius2, fill_t fillit=NOFILL)
 Draw an Ellipse.
RetCode_t Power (bool on)
 Control display power.
RetCode_t Reset (void)
 Reset the display controller via the Software Reset interface.
RetCode_t Backlight_u8 (unsigned char brightness)
 Set backlight brightness.
RetCode_t Backlight (float brightness)
 Set backlight brightness.
virtual RetCode_t set_font (const unsigned char *font=NULL)
 Select a bitmap font (provided by the user) for all subsequent text.
color_t DOSColor (int i)
 Get the RGB value for a DOS color.
const char * DOSColorNames (int i)
 Get the color name (string) for a DOS color.
void ClearPerformance ()
 Clear the performance metrics to zero.
void ReportPerformance (Serial &pc)
 Report the performance metrics for drawing functions using the available serial channel.
virtual int fontblit (int x, int y, const unsigned char *fontTable, const unsigned char *fontChar)
 This method transfers one character from the external font data to the screen.
color_t RGBQuadToRGB16 (RGBQUAD *colorPalette, uint16_t i)
 This method returns the color value from a palette.
RGBQUAD RGB16ToRGBQuad (color_t c)
 This method converts a 16-bit color value into a 24-bit RGB Quad.
RetCode_t RenderImageFile (loc_t x, loc_t y, const char *FileName)
 This method attempts to render a specified graphics image file at the specified screen location.
RetCode_t RenderBitmapFile (loc_t x, loc_t y, const char *Name_BMP)
 This method reads a disk file that is in bitmap format and puts it on the screen.
RetCode_t RenderIconFile (loc_t x, loc_t y, const char *Name_ICO)
 This method reads a disk file that is in ico format and puts it on the screen.
RetCode_t PrintScreen (loc_t x, loc_t y, dim_t w, dim_t h, const char *Name_BMP)
 This method captures the specified area as a 24-bit bitmap file.
virtual int character (int x, int y, int value)
 prints one character at the specified coordinates.
virtual bool claim (FILE *stream)
 redirect output from a stream (stoud, sterr) to display

Protected Member Functions

RetCode_t _RenderBitmap (loc_t x, loc_t y, uint32_t fileOffset, FILE *Image)
 Protected method to render an image given a file handle and coordinates.

Detailed Description

This is a graphics library for the Raio RA8875 Display Controller chip attached to a 4-wire SPI interface.

It offers both primitive and high level APIs.\ Central to this API is a coordinate system, where the origin (0,0) is in the top-left corner of the display, and the width extends positive to the right and the height extends positive toward the bottom.

As there are both graphics and text commands, one must take care to use the proper coordinate system for each. Some of the text APIs are in units of column and row, which is measured in character positions (and dependent on the font size), and other text APIs permit pixel level positioning.

Definition at line 72 of file RA8875.h.


Member Typedef Documentation

typedef int HorizontalScale

Scale factor - 1, 2, 3 4.

Definition at line 99 of file RA8875.h.

typedef int VerticalScale

Scale factor - 1, 2, 3, 4.

Definition at line 102 of file RA8875.h.


Member Enumeration Documentation

alignment

Enumerator:
align_none 

align - none

align_full 

align - full

Definition at line 92 of file RA8875.h.

font rotation selection

Enumerator:
normal 

normal orientation

rotated 

rotated orientation

Definition at line 85 of file RA8875.h.

enum font_t

font type selection.

Enumerator:
ISO8859_1 

ISO8859-1 font.

ISO8859_2 

ISO8859-2 font.

ISO8859_3 

ISO8859-3 font.

ISO8859_4 

ISO8859-4 font.

Definition at line 76 of file RA8875.h.

enum Region_t

Clear screen region.

Enumerator:
FULLWINDOW 

Full screen.

ACTIVEWINDOW 

active window/region

Definition at line 105 of file RA8875.h.


Constructor & Destructor Documentation

RA8875 ( PinName  mosi,
PinName  miso,
PinName  sclk,
PinName  csel,
PinName  reset,
const char *  name = "lcd" 
)

Constructor for a display based on the RAiO RA8875 display controller.

Parameters:
mosiis the SPI master out slave in pin on the mbed.
misois the SPI master in slave out pin on the mbed.
sclkis the SPI shift clock pin on the mbed.
cselis the DigitalOut pin on the mbed to use as the active low chip select for the display controller.
resetis the DigitalOut pin on the mbed to use as the active low reset input on the display controller - but this is not currently used.
nameis a text name for this object, which will permit capturing stdout and printf() directly to it.

Definition at line 51 of file RA8875.cpp.


Member Function Documentation

int _putc ( int  c ) [virtual]

put a character on the screen.

Parameters:
cis the character.
Returns:
the character, or EOF if there is an error.

Reimplemented from TextDisplay.

Definition at line 411 of file RA8875.cpp.

RetCode_t _RenderBitmap ( loc_t  x,
loc_t  y,
uint32_t  fileOffset,
FILE *  Image 
) [protected, inherited]

Protected method to render an image given a file handle and coordinates.

Parameters:
xis the horizontal pixel coordinate
yis the vertical pixel coordinate
wis the image width restriction, or zero to permit full image width.
his the image height restriction, or zero to permit full image height.
fileOffsetis the offset into the file where the image data starts
Imageis the filename stream already opened for the data.
Returns:
success or error code.

Definition at line 450 of file GraphicsDisplay.cpp.

RetCode_t background ( unsigned char  r,
unsigned char  g,
unsigned char  b 
) [virtual]

Set the background color.

Parameters:
ris the red element of the color.
gis the green element of the color.
bis the blue element of the color.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 1017 of file RA8875.cpp.

RetCode_t background ( color_t  color ) [virtual]

Set the background color.

Parameters:
coloris expressed in 16-bit format.
Returns:
success/failure code.
See also:
RetCode_t.

Implements TextDisplay.

Definition at line 1007 of file RA8875.cpp.

RetCode_t Backlight ( float  brightness )

Set backlight brightness.

When the built-in PWM is used to control the backlight, this API can be used to set the brightness.

Parameters:
brightnessranges from 0.0 (off) to 1.0 (full on)
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 982 of file RA8875.cpp.

RetCode_t Backlight_u8 ( unsigned char  brightness )

Set backlight brightness.

When the built-in PWM is used to control the backlight, this API can be used to set the brightness.

Parameters:
brightnessranges from 0 (off) to 255 (full on)
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 963 of file RA8875.cpp.

int character ( int  x,
int  y,
int  value 
) [virtual, inherited]

prints one character at the specified coordinates.

This will print the character at the specified pixel coordinates.

Parameters:
xis the horizontal offset in pixels.
yis the vertical offset in pixels.
valueis the character to print.
Returns:
number of pixels to index to the right if a character was printed, 0 otherwise.

Implements TextDisplay.

Definition at line 196 of file GraphicsDisplay.cpp.

RetCode_t circle ( loc_t  x,
loc_t  y,
dim_t  radius,
color_t  color,
fill_t  fillit = NOFILL 
)

Draw a circle using the specified color.

Note:
As a side effect, this changes the current foreground color for subsequent operations.
Parameters:
xis the horizontal center of the circle.
yis the vertical center of the circle.
radiusdefines the size of the circle.
colordefines the foreground color.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 850 of file RA8875.cpp.

RetCode_t circle ( loc_t  x,
loc_t  y,
dim_t  radius,
fill_t  fillit = NOFILL 
)

Draw a circle.

Draws a circle using the foreground color setting.

Parameters:
xis the horizontal center of the circle.
yis the vertical center of the circle.
radiusdefines the size of the circle.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 866 of file RA8875.cpp.

bool claim ( FILE *  stream ) [virtual, inherited]

redirect output from a stream (stoud, sterr) to display

Note:
this method may be overridden in a derived class.
Parameters:
streamthat shall be redirected to the TextDisplay
Returns:
true if the claim succeeded.

Definition at line 95 of file TextDisplay.cpp.

void ClearPerformance (  )

Clear the performance metrics to zero.

Definition at line 109 of file RA8875.cpp.

RetCode_t cls ( void   ) [virtual]

Clear the screen.

The behavior is to clear the whole screen.

See also:
clsw().
Returns:
success/failure code.
See also:
RetCode_t.

Reimplemented from GraphicsDisplay.

Definition at line 570 of file RA8875.cpp.

RetCode_t clsw ( RA8875::Region_t  region = FULLWINDOW )

Clear the screen, or clear only the active window.

The default behavior is to clear the whole screen. With the optional parameter, the action can be restricted to the active window, which can be set with the

See also:
window method.
Parameters:
regionis an optional parameter that defaults to FULLWINDOW or may be set to ACTIVEWINDOW.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 580 of file RA8875.cpp.

dim_t color_bpp ( void   ) [virtual]

get the color depth in bits per pixel.

Returns:
8 or 16 only.

Definition at line 282 of file RA8875.cpp.

int columns ( void   ) [virtual]

get the number of colums based on the currently active font

Returns:
number of columns.

Reimplemented from GraphicsDisplay.

Definition at line 258 of file RA8875.cpp.

color_t DOSColor ( int  i )

Get the RGB value for a DOS color.

Parameters:
iis the color, in the range 0 to 15;
Returns:
the RGB color of the selected index, or 0 if the index is out of bounds.

Definition at line 1058 of file RA8875.cpp.

const char * DOSColorNames ( int  i )

Get the color name (string) for a DOS color.

Parameters:
iis the color, in the range 0 to 15;
Returns:
a pointer to a string with the color name, or NULL if the index is out of bounds.

Definition at line 1074 of file RA8875.cpp.

RetCode_t ellipse ( loc_t  x,
loc_t  y,
dim_t  radius1,
dim_t  radius2,
color_t  color,
fill_t  fillit = NOFILL 
)

Draw an Ellipse using the specified color.

Note:
As a side effect, this changes the current foreground color for subsequent operations.
Parameters:
xis the horizontal center of the ellipse.
yis the vertical center of the ellipse.
radius1defines the horizontal radius of the ellipse.
radius2defines the vertical radius of the ellipse.
colordefines the foreground color.
fillitdefines whether the circle is filled or not.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 892 of file RA8875.cpp.

RetCode_t ellipse ( loc_t  x,
loc_t  y,
dim_t  radius1,
dim_t  radius2,
fill_t  fillit = NOFILL 
)

Draw an Ellipse.

Draws it using the foreground color setting.

Parameters:
xis the horizontal center of the ellipse.
yis the vertical center of the ellipse.
radius1defines the horizontal radius of the ellipse.
radius2defines the vertical radius of the ellipse.
fillitdefines whether the circle is filled or not.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 906 of file RA8875.cpp.

RetCode_t fillcircle ( loc_t  x,
loc_t  y,
dim_t  radius,
color_t  color,
fill_t  fillit = FILL 
)

Draw a filled circle using the specified color.

Note:
As a side effect, this changes the current foreground color for subsequent operations.
Parameters:
xis the horizontal center of the circle.
yis the vertical center of the circle.
radiusdefines the size of the circle.
colordefines the foreground color.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 858 of file RA8875.cpp.

RetCode_t fillellipse ( loc_t  x,
loc_t  y,
dim_t  radius1,
dim_t  radius2,
color_t  color,
fill_t  fillit = FILL 
)

Draw a filled Ellipse using the specified color.

Note:
As a side effect, this changes the current foreground color for subsequent operations.
Parameters:
xis the horizontal center of the ellipse.
yis the vertical center of the ellipse.
radius1defines the horizontal radius of the ellipse.
radius2defines the vertical radius of the ellipse.
colordefines the foreground color.
fillitdefines whether the circle is filled or not.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 899 of file RA8875.cpp.

RetCode_t fillrect ( loc_t  x1,
loc_t  y1,
loc_t  x2,
loc_t  y2,
color_t  color,
fill_t  fillit = FILL 
) [virtual]

Draw a filled rectangle in the specified color.

Note:
As a side effect, this changes the current foreground color for subsequent operations.
Parameters:
x1is the horizontal start of the line.
y1is the vertical start of the line.
x2is the horizontal end of the line.
y2is the vertical end of the line.
colordefines the foreground color.
fillitis optional to NOFILL the rectangle. default is FILL.
Returns:
success/failure code.
See also:
RetCode_t.

Implements GraphicsDisplay.

Definition at line 704 of file RA8875.cpp.

RetCode_t fillroundrect ( loc_t  x1,
loc_t  y1,
loc_t  x2,
loc_t  y2,
dim_t  radius1,
dim_t  radius2,
color_t  color,
fill_t  fillit = FILL 
)

Draw a filled rectangle with rounded corners using the specified color.

This draws a rounded rectangle. A numbers of checks are made on the values, and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2), or a single point (x1 == x2 && y1 == y2). If the radius parameters are > 1/2 the length of that side (width or height), an error value is returned.

Note:
As a side effect, this changes the current foreground color for subsequent operations.
Parameters:
x1is the horizontal start of the line and must be <= x2.
y1is the vertical start of the line and must be <= y2.
x2is the horizontal end of the line and must be >= x1.
y2is the vertical end of the line and must be >= y1.
radius1defines the horizontal radius of the curved corner. Take care that this value < 1/2 the width of the rectangle, or bad_parameter is returned.
radius2defines the vertical radius of the curved corner. Take care that this value < 1/2 the height of the rectangle, or bad_parameter is returned.
colordefines the foreground color.
fillitis optional to FILL the rectangle. default is NOFILL.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 747 of file RA8875.cpp.

RetCode_t filltriangle ( loc_t  x1,
loc_t  y1,
loc_t  x2,
loc_t  y2,
loc_t  x3,
loc_t  y3,
color_t  color,
fill_t  fillit = FILL 
)

Draw a filled triangle in the specified color.

Note:
As a side effect, this changes the current foreground color for subsequent operations.
Parameters:
x1is the horizontal for point 1.
y1is the vertical for point 1.
x2is the horizontal for point 2.
y2is the vertical for point 2.
x3is the horizontal for point 3.
y3is the vertical for point 3.
colordefines the foreground color.
fillitis optional to FILL the rectangle. default is NOFILL.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 812 of file RA8875.cpp.

int fontblit ( int  x,
int  y,
const unsigned char *  fontTable,
const unsigned char *  fontChar 
) [virtual, inherited]

This method transfers one character from the external font data to the screen.

Note:
the font data is in a special format as generate by the mikroe font creator. \ See http://www.mikroe.com/glcd-font-creator/
Parameters:
xis the horizontal pixel coordinate
yis the vertical pixel coordinate
fontTableis the base of the table which has the metrics
fontCharis the start of that record in the table for the char (e.g. 'A' - 'Z')
Returns:
how far the cursor should advance to the right in pixels

Definition at line 299 of file GraphicsDisplay.cpp.

dim_t fontheight ( void   )

get the height in pixels of the currently active font

Returns:
font height in pixels.

Definition at line 243 of file RA8875.cpp.

dim_t fontwidth ( void   )

get the width in pixels of the currently active font

Returns:
font width in pixels.

Definition at line 234 of file RA8875.cpp.

RetCode_t foreground ( color_t  color ) [virtual]

Set the foreground color.

Parameters:
coloris expressed in 16-bit format.
Returns:
success/failure code.
See also:
RetCode_t.

Implements TextDisplay.

Definition at line 1027 of file RA8875.cpp.

RetCode_t foreground ( unsigned char  r,
unsigned char  g,
unsigned char  b 
) [virtual]

Set the foreground color.

Parameters:
ris the red element of the color.
gis the green element of the color.
bis the blue element of the color.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 1037 of file RA8875.cpp.

color_t GetForeColor ( void   )

Get the current foreground color value.

Returns:
the current foreground color.

Definition at line 1047 of file RA8875.cpp.

color_t getPixel ( loc_t  x,
loc_t  y 
) [virtual]

Get a pixel from the display.

Parameters:
xis the horizontal offset to this pixel.
yis the vertical offset to this pixel.
Returns:
the pixel. see

Implements GraphicsDisplay.

Definition at line 637 of file RA8875.cpp.

RetCode_t getPixelStream ( color_t *  p,
uint32_t  count,
loc_t  x,
loc_t  y 
) [virtual]

Get a stream of pixels from the display.

Parameters:
pis a pointer to a color_t array to accept the stream.
countis the number of pixels to read.
xis the horizontal offset to this pixel.
yis the vertical offset to this pixel.
Returns:
success/failure code.
See also:
RetCode_t.

Implements GraphicsDisplay.

Definition at line 657 of file RA8875.cpp.

point_t GetTextCursor ( void   )

Get the current cursor position in pixels.

Returns:
cursor position.
loc_t GetTextCursor_X ( void   )

Get the current cursor horizontal position in pixels.

Returns:
cursor position horizontal offset.

Definition at line 309 of file RA8875.cpp.

loc_t GetTextCursor_Y ( void   )

Get the current cursor vertical position in pixels.

Returns:
cursor position vertical offset.

Definition at line 300 of file RA8875.cpp.

dim_t height ( void   ) [virtual]

get the screen height in pixels

Returns:
screen height in pixels.

Implements GraphicsDisplay.

Definition at line 276 of file RA8875.cpp.

RetCode_t line ( loc_t  x1,
loc_t  y1,
loc_t  x2,
loc_t  y2,
color_t  color 
)

Draw a line in the specified color.

Note:
As a side effect, this changes the current foreground color for subsequent operations.
Parameters:
x1is the horizontal start of the line.
y1is the vertical start of the line.
x2is the horizontal end of the line.
y2is the vertical end of the line.
colordefines the foreground color.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 680 of file RA8875.cpp.

RetCode_t line ( loc_t  x1,
loc_t  y1,
loc_t  x2,
loc_t  y2 
)

Draw a line.

Draws a line using the foreground color setting.

Parameters:
x1is the horizontal start of the line.
y1is the vertical start of the line.
x2is the horizontal end of the line.
y2is the vertical end of the line.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 687 of file RA8875.cpp.

RetCode_t locate ( textloc_t  column,
textloc_t  row 
) [virtual]

Set cursor position based on the current font size.

Parameters:
columnis the horizontal position in character positions
rowis the vertical position in character positions
Returns:
success/failure code.
See also:
RetCode_t.

Implements TextDisplay.

Definition at line 252 of file RA8875.cpp.

RetCode_t pixel ( loc_t  x,
loc_t  y,
color_t  color 
) [virtual]

Draw a pixel in the specified color.

Note:
Unlike many other operations, this does not set the forecolor!
Parameters:
xis the horizontal offset to this pixel.
yis the vertical offset to this pixel.
colordefines the color for the pixel.
Returns:
success/failure code.
See also:
RetCode_t.

Implements GraphicsDisplay.

Definition at line 591 of file RA8875.cpp.

RetCode_t pixel ( loc_t  x,
loc_t  y 
) [virtual]

Draw a pixel in the current foreground color.

Parameters:
xis the horizontal offset to this pixel.
yis the veritical offset to this pixel.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 602 of file RA8875.cpp.

RetCode_t pixelStream ( color_t *  p,
uint32_t  count,
loc_t  x,
loc_t  y 
) [virtual]

Write a stream of pixels to the display.

Parameters:
pis a pointer to a color_t array to write.
countis the number of pixels to write.
xis the horizontal position on the display.
yis the vertical position on the display.
Returns:
success/failure code.
See also:
RetCode_t.

Implements GraphicsDisplay.

Definition at line 618 of file RA8875.cpp.

RetCode_t Power ( bool  on )

Control display power.

Parameters:
onwhen set to true will turn on the display, when false it is turned off.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 945 of file RA8875.cpp.

RetCode_t PrintScreen ( loc_t  x,
loc_t  y,
dim_t  w,
dim_t  h,
const char *  Name_BMP 
) [inherited]

This method captures the specified area as a 24-bit bitmap file.

Even though this is a 16-bit display, the stored image is in 24-bit format.

Parameters:
xis the left edge of the region to capture
yis the top edge of the region to capture
wis the width of the region to capture
his the height of the region to capture.
Returns:
success or error code.

Definition at line 361 of file GraphicsDisplay.cpp.

void puts ( const char *  string )

Write string of text to the display.

Parameters:
stringis the null terminated string to send to the display.

Definition at line 508 of file RA8875.cpp.

void puts ( loc_t  x,
loc_t  y,
const char *  string 
)

Write string of text to the display at the specified location.

Parameters:
xis the horizontal position in pixels (from the left edge)
yis the vertical position in pixels (from the top edge)
stringis the null terminated string to send to the display.

Definition at line 501 of file RA8875.cpp.

unsigned char ReadCommand ( unsigned char  command )

Read a command register.

Parameters:
commandis the command register to read.
Returns:
the value read from the register.

Definition at line 190 of file RA8875.cpp.

unsigned char ReadData ( void   )

Read a data byte from the display.

This is a high level command, and may invoke several primitives.

Returns:
data that was read.

Definition at line 197 of file RA8875.cpp.

uint16_t ReadDataW ( void   )

Read a word from the display.

This is a high level command, and may invoke several primitives.

Returns:
data that was read.

Definition at line 209 of file RA8875.cpp.

unsigned char ReadStatus ( void   )

Read the display status.

This is a high level command, and may invoke several primitives.

Returns:
data that was read.

Definition at line 222 of file RA8875.cpp.

RetCode_t rect ( loc_t  x1,
loc_t  y1,
loc_t  x2,
loc_t  y2,
color_t  color,
fill_t  fillit = NOFILL 
)

Draw a rectangle in the specified color.

Note:
As a side effect, this changes the current foreground color for subsequent operations.
Parameters:
x1is the horizontal start of the line.
y1is the vertical start of the line.
x2is the horizontal end of the line.
y2is the vertical end of the line.
colordefines the foreground color.
fillitis optional to FILL the rectangle. default is NOFILL.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 711 of file RA8875.cpp.

RetCode_t rect ( loc_t  x1,
loc_t  y1,
loc_t  x2,
loc_t  y2,
fill_t  fillit = NOFILL 
)

Draw a rectangle.

Draws a rectangle using the foreground color setting.

Parameters:
x1is the horizontal start of the line.
y1is the vertical start of the line.
x2is the horizontal end of the line.
y2is the vertical end of the line.
fillitis optional to FILL the rectangle. default is NOFILL.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 719 of file RA8875.cpp.

RetCode_t RenderBitmapFile ( loc_t  x,
loc_t  y,
const char *  Name_BMP 
) [inherited]

This method reads a disk file that is in bitmap format and puts it on the screen.

Supported formats:

  • 4-bit color format (16 colors)
  • 8-bit color format (256 colors)
  • 16-bit color format (65k colors)
  • compression: no.
Note:
This is a slow operation, typically due to the use of the file system, and partially because bmp files are stored from the bottom up, and the memory is written from the top down; as a result, it constantly 'seeks' on the file system for the next row of information.

As a performance test, a sample picture was timed. A family picture was converted to Bitmap format; shrunk to 352 x 272 pixels and save in 8-bit color format. The resulting file size was 94.5 KByte. The SPI port interface was set to 20 MHz. The original bitmap rendering software was purely in software, pushing 1 pixel at a time to the write function, which did use SPI hardware (not pin wiggling) to transfer commands and data to the display. Then, the driver was improved to leverage the capability of the derived display driver. As a final check, instead of the [known slow] local file system, a randomly chosen USB stick was used. The performance results are impressive (but depend on the listed factors).

  • 34 seconds, LocalFileSystem, Software Rendering
  • 9 seconds, LocalFileSystem, Hardware Rending for RA8875
  • 3 seconds, MSCFileSystem, Hardware Rendering for RA8875
Parameters:
xis the horizontal pixel coordinate
yis the vertical pixel coordinate
Name_BMPis the filename on the mounted file system.
Returns:
success or error code.

Definition at line 580 of file GraphicsDisplay.cpp.

RetCode_t RenderIconFile ( loc_t  x,
loc_t  y,
const char *  Name_ICO 
) [inherited]

This method reads a disk file that is in ico format and puts it on the screen.

Reading the disk is slow, but a typical icon file is small so it should be ok.

Note:
An Icon file can have more than one icon in it. This implementation only processes the first image in the file.
Parameters:
xis the horizontal pixel coordinate
yis the vertical pixel coordinate
Name_ICOis the filename on the mounted file system.
Returns:
success or error code.

Definition at line 606 of file GraphicsDisplay.cpp.

RetCode_t RenderImageFile ( loc_t  x,
loc_t  y,
const char *  FileName 
) [inherited]

This method attempts to render a specified graphics image file at the specified screen location.

This supports several variants of the following file types:

  • Bitmap file format,
  • Icon file format.
Note:
The specified image width and height, when adjusted for the x and y origin, must fit on the screen, or the image will not be shown (it does not clip the image).
The file extension is tested, and if it ends in a supported format, the appropriate handler is called to render that image.
Parameters:
xis the horizontal pixel coordinate
yis the vertical pixel coordinate
FileNamerefers to the fully qualified path and file on a mounted file system.
Returns:
success or error code.

Definition at line 569 of file GraphicsDisplay.cpp.

void ReportPerformance ( Serial &  pc )

Report the performance metrics for drawing functions using the available serial channel.

Parameters:
pcis the serial channel to write to.

Definition at line 125 of file RA8875.cpp.

RetCode_t Reset ( void   )

Reset the display controller via the Software Reset interface.

Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 952 of file RA8875.cpp.

RGBQUAD RGB16ToRGBQuad ( color_t  c ) [inherited]

This method converts a 16-bit color value into a 24-bit RGB Quad.

RRRR RGGG GGGB BBBB.

Parameters:
cis the 16-bit color.
See also:
color_t
Returns:
an RGBQUAD value.
See also:
RGBQUAD

Definition at line 348 of file GraphicsDisplay.cpp.

color_t RGBQuadToRGB16 ( RGBQUAD *  colorPalette,
uint16_t  i 
) [inherited]

This method returns the color value from a palette.

This method accepts a pointer to a Bitmap color palette, which is a table in memory composed of RGB Quad values (r, g, b, 0), and an index into that table. It then extracts the color information and downsamples it to a color_t value which it returns.

Note:
This method probably has very little value outside of the internal methods for reading BMP files.
Parameters:
colorPaletteis the handle to the color palette to use.
iis the index into the color palette.
Returns:
the color in color_t format.

Definition at line 337 of file GraphicsDisplay.cpp.

RetCode_t roundrect ( loc_t  x1,
loc_t  y1,
loc_t  x2,
loc_t  y2,
dim_t  radius1,
dim_t  radius2,
fill_t  fillit = NOFILL 
)

Draw a rectangle with rounded corners.

This draws a rounded rectangle. A numbers of checks are made on the values, and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2), or a single point (x1 == x2 && y1 == y2). If the radius parameters are > 1/2 the length of that side (width or height), an error value is returned.

Parameters:
x1is the horizontal start of the line and must be <= x2.
y1is the vertical start of the line and must be <= y2.
x2is the horizontal end of the line and must be >= x1.
y2is the vertical end of the line and must be >= y1.
radius1defines the horizontal radius of the curved corner. Take care that this value < 1/2 the width of the rectangle, or bad_parameter is returned.
radius2defines the vertical radius of the curved corner. Take care that this value < 1/2 the height of the rectangle, or bad_parameter is returned.
fillitis optional to FILL the rectangle. default is NOFILL.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 763 of file RA8875.cpp.

RetCode_t roundrect ( loc_t  x1,
loc_t  y1,
loc_t  x2,
loc_t  y2,
dim_t  radius1,
dim_t  radius2,
color_t  color,
fill_t  fillit = NOFILL 
)

Draw a rectangle with rounded corners using the specified color.

This draws a rounded rectangle. A numbers of checks are made on the values, and it could reduce this to drawing a line (if either x1 == x2, or y1 == y2), or a single point (x1 == x2 && y1 == y2). If the radius parameters are > 1/2 the length of that side (width or height), an error value is returned.

Note:
As a side effect, this changes the current foreground color for subsequent operations.
Parameters:
x1is the horizontal start of the line and must be <= x2.
y1is the vertical start of the line and must be <= y2.
x2is the horizontal end of the line and must be >= x1.
y2is the vertical end of the line and must be >= y1.
radius1defines the horizontal radius of the curved corner. Take care that this value < 1/2 the width of the rectangle, or bad_parameter is returned.
radius2defines the vertical radius of the curved corner. Take care that this value < 1/2 the height of the rectangle, or bad_parameter is returned.
colordefines the foreground color.
fillitis optional to FILL the rectangle. default is NOFILL.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 755 of file RA8875.cpp.

int rows ( void   ) [virtual]

get the number of rows based on the currently active font

Returns:
number of rows.

Reimplemented from GraphicsDisplay.

Definition at line 264 of file RA8875.cpp.

RetCode_t SelectLayer ( uint16_t  layer )

Select the layer for subsequent commands.

If the screen configuration is 480 x 272, or if it is 800 x 480 and 8-bit color, the the display supports two layers, which can be independently drawn on and shown. Additionally, complex operations involving both layers are permitted.

Note:
The user manual refers to Layer 1 and Layer 2, however the actual register values are value 0 and 1. This and other APIs use the values 0 and 1.
Parameters:
layerselects the layer for subsequence commands, where the values 0 and 1 represent layers 1 and 2 (as referred to in the user manual).
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 75 of file RA8875.cpp.

RetCode_t set_font ( const unsigned char *  font = NULL ) [virtual]

Select a bitmap font (provided by the user) for all subsequent text.

Note:
Tool to create the fonts is accessible from its creator available at http://www.mikroe.com. Change the data to an array of type char[].
Parameters:
fontis a pointer to a specially formed font array. This special font array has a 4-byte header, followed by the data:

  • the number of bytes per char
  • the vertical size in pixels for each character
  • the horizontal size in pixels for each character
  • the number of bytes per vertical line (width of the array)
Returns:
error code.

Reimplemented from GraphicsDisplay.

Definition at line 996 of file RA8875.cpp.

RetCode_t SetGraphicsCursor ( loc_t  x,
loc_t  y 
) [virtual]

Prepare the controller to write binary data to the screen by positioning the memory cursor.

Parameters:
xis the horizontal position in pixels (from the left edge)
yis the vertical position in pixels (from the top edge)
Returns:
success/failure code.
See also:
RetCode_t.

Implements GraphicsDisplay.

Definition at line 540 of file RA8875.cpp.

RetCode_t SetGraphicsCursorRead ( loc_t  x,
loc_t  y 
) [virtual]

Prepare the controller to read binary data from the screen by positioning the memory read cursor.

Parameters:
xis the horizontal position in pixels (from the left edge)
yis the vertical position in pixels (from the top edge)
Returns:
success/failure code.
See also:
RetCode_t.

Implements GraphicsDisplay.

Definition at line 548 of file RA8875.cpp.

RetCode_t SetLayerMode ( uint8_t  mode )

Set the Layer presentation mode.

This sets the presentation mode for layers, and permits showing a single layer, or applying a mode where the two layers are combined using one of the hardware methods.

Parameters:
modesets the mode in the Layer Transparency Register.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 90 of file RA8875.cpp.

RetCode_t SetLayerTransparency ( uint8_t  layer1,
uint8_t  layer2 
)

Set the layer transparency for each layer.

Set the transparency, where the range of values is from zero (fully visible) to eight (fully transparent). The input value is automatically limited to this range.

Parameters:
layer1sets the layer 1 transparency.
layer2sets the layer 2 transparency.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 97 of file RA8875.cpp.

RetCode_t SetTextCursor ( loc_t  x,
loc_t  y 
)

Prepare the controller to write text to the screen by positioning the cursor.

Parameters:
xis the horizontal position in pixels (from the left edge)
yis the vertical position in pixels (from the top edge)
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 291 of file RA8875.cpp.

RetCode_t SetTextCursorControl ( cursor_t  cursor = NOCURSOR,
bool  blink = false 
)

Configure additional Cursor Control settings.

This API lets you modify other cursor control settings; Cursor visible/hidden, Cursor blink/normal, Cursor I-Beam/underscore/box.

Parameters:
cursorcan be set to NOCURSOR (default), IBEAM, UNDER, or BLOCK.
blinkcan be set to true or false (default false)
Returns:
success/failure code.
See also:
RetCode_t

Definition at line 318 of file RA8875.cpp.

RetCode_t SetTextFont ( RA8875::font_t  font = ISO8859_1 )

Select the ISO 8859-X font to use next.

Supported fonts: ISO 8859-1, -2, -3, -4

Parameters:
fontselects the font for the subsequent text rendering.
Note:
if either hScale or vScale is outside of its permitted range, the command is not executed.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 356 of file RA8875.cpp.

RetCode_t SetTextFontControl ( fill_t  fillit = FILL,
RA8875::font_angle_t  angle = normal,
RA8875::HorizontalScale  hScale = 1,
RA8875::VerticalScale  vScale = 1,
RA8875::alignment_t  alignment = align_none 
)

Control the font behavior.

This command lets you make several modifications to any text that is written.

Options can be combined: Default:

  • Full alignment disabled,
  • Font with Background color,
  • Font in normal orientiation,
  • Horizontal scale x 1
  • Vertical scale x 1
  • alignment
Parameters:
fillitdefaults to FILL, but can be NOFILL
angledefaults to normal, but can be rotated
hScaledefaults to 1, but can be 1, 2, 3, or 4, and scales the font size by this amount.
vScaledefaults to 1, but can be 1, 2, 3, or 4, and scales the font size by this amount.
alignmentdefaults to align_none, but can be align_full.
Note:
if either hScale or vScale is outside of its permitted range, the command is not executed.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 367 of file RA8875.cpp.

RetCode_t SetTextFontSize ( RA8875::HorizontalScale  hScale = 1,
RA8875::VerticalScale  vScale = -1 
)

Control the font size.

This command lets you set the font enlargement for both horizontal and vertical, independent of the rotation, background, and alignment.

See also:
SetTextFontControl.
Parameters:
hScaledefaults to 1, but can be 1, 2, 3, or 4, and scales the font size by this amount.
vScaleis an optional parameter that defaults to the hScale value, but can be 1, 2, 3, or 4, and scales the font size by this amount.
     lcd.SetTextFontSize(2);     // Set the font to 2x normal size
     lcd.SetTextFontSize(2,3);   // Set the font to 2x Width and 3x Height
     lcd.SetTextFontSize();      // Restore to normal size in both dimensions
Note:
if either hScale or vScale is outside of its permitted range, the command is not executed.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 393 of file RA8875.cpp.

RetCode_t triangle ( loc_t  x1,
loc_t  y1,
loc_t  x2,
loc_t  y2,
loc_t  x3,
loc_t  y3,
color_t  color,
fill_t  fillit = NOFILL 
)

Draw a triangle in the specified color.

Note:
As a side effect, this changes the current foreground color for subsequent operations.
Parameters:
x1is the horizontal for point 1.
y1is the vertical for point 1.
x2is the horizontal for point 2.
y2is the vertical for point 2.
x3is the horizontal for point 3.
y3is the vertical for point 3.
colordefines the foreground color.
fillitis optional to FILL the rectangle. default is NOFILL.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 801 of file RA8875.cpp.

RetCode_t triangle ( loc_t  x1,
loc_t  y1,
loc_t  x2,
loc_t  y2,
loc_t  x3,
loc_t  y3,
fill_t  fillit = NOFILL 
)

Draw a triangle.

Draws a triangle using the foreground color setting.

Parameters:
x1is the horizontal for point 1.
y1is the vertical for point 1.
x2is the horizontal for point 2.
y2is the vertical for point 2.
x3is the horizontal for point 3.
y3is the vertical for point 3.
fillitis optional to FILL the rectangle. default is NOFILL.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 823 of file RA8875.cpp.

dim_t width ( void   ) [virtual]

get the screen width in pixels

Returns:
screen width in pixels.

Implements GraphicsDisplay.

Definition at line 270 of file RA8875.cpp.

RetCode_t window ( loc_t  x,
loc_t  y,
dim_t  width,
dim_t  height 
) [virtual]

Set the window, which controls where items are written to the screen.

When something hits the window width, it wraps back to the left side and down a row. If the initial write is outside the window, it will be captured into the window when it crosses a boundary.

Parameters:
xis the left edge in pixels.
yis the top edge in pixels.
widthis the window width in pixels.
heightis the window height in pixels.
Returns:
success/failure code.
See also:
RetCode_t.

Reimplemented from GraphicsDisplay.

Definition at line 558 of file RA8875.cpp.

RetCode_t WriteCommand ( unsigned char  command,
unsigned int  data = 0xFFFF 
) [virtual]

Write a command to the display.

This is a high level command, and may invoke several primitives.

Parameters:
commandis the command to write.
datais optional data to be written to the command register and only occurs if the data is in the range [0 - 0xFF].
Returns:
success/failure code.
See also:
RetCode_t.

Implements GraphicsDisplay.

Definition at line 155 of file RA8875.cpp.

RetCode_t WriteCommandW ( uint8_t  command,
uint16_t  data 
)

Write a command to the display with a word of data.

This is a high level command, and may invoke several primitives.

Parameters:
commandis the command to write.
datais data to be written to the command register.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 135 of file RA8875.cpp.

RetCode_t WriteData ( unsigned char  data ) [virtual]

Write a data byte to the display.

This is a high level command, and may invoke several primitives.

Parameters:
datais the data to write.
Returns:
success/failure code.
See also:
RetCode_t.

Implements GraphicsDisplay.

Definition at line 180 of file RA8875.cpp.

RetCode_t WriteDataW ( uint16_t  data )

Write a data word to the display.

This is a high level command, and may invoke several primitives.

Parameters:
datais the data to write.
Returns:
success/failure code.
See also:
RetCode_t.

Definition at line 169 of file RA8875.cpp.