Skip to content

tc-/ColorLCDShield

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

	************************************
	*                                  *
	*          ColorLCDShield          *
	*                                  *
	*        an Arduino Library        *
	*                                  *
	*         by Jim Lindblom          *
	*       SparkFun Electronics       *
	*                                  *
	************************************

License: CC-BY SA 3.0 - Creative commons share-alike 3.0
use this code however you'd like, just keep this license and
attribute. Let me know if you make hugely, awesome, great changes.

Huge thanks to Jim Lynch, Mark Sproul, and Peter Davenport. If I'm
missing anyone, I apologize, all of this code's been through the
ringer more than a few times.

This is a (hopefully) simple Arduino library for use specifically
with SparkFun Electronics' Color LCD Shield
(http://www.sparkfun.com/products/9363). It'll no doubt work with
other incarnations of LCD breakouts and what not, you just might
have to do some modifying of the pin defintions.

The code gives you access to the following LCD functions:

LCDShield(); - The library's constructor. An instance of the lcd must
be created at the beginning of any code. e.g:
LCDShield lcd;

void init(int type); - This initializes an LCD. Either EPSON or PHILLIPS
should be passed as the type variable. This function should be called 
near the beginning of any function (setup()!). Turns on the display, sets
the contrast and uinitializes the LCD into 12-bit RGB color mode.

void clear(int color); - Clears the entire screen, filling it with the 
12-bit RGB color passed to it. There are a number of predefined colors in
ColorLCDShield.h

void contrast(char setting); - Manually adjusts the contrast. A value between
0 and 60 should be passed. 40 works pretty well for me.

void setPixel(int color, unsigned char x, unsigned char y); - Draws a single
pixel at the specified x, y location. Color is a 12-bit RGB value.

void setCircle (int x0, int y0, int radius, int color); - Draws a circle centered
around x0, y0, of the specified radius and color. Radius is in pixels, color is
a 12-bit RGB value.

void setChar(char c, int x, int y, int fColor, int bColor); - Sets a single 
character down at the specified x/y coordinate. You can pick both the foreground
and background color, they're 12-bit RGB values. Only one font is available in
this library. Definitely room for growth, though at an added cost of memory.

void setStr(char *pString, int x, int y, int fColor, int bColor); - Sets a string
of characters down, beginning at x/y coordinates. You can pick both the foreground
and background color, they're 12-bit RGB values. Only one font is available in
this library. Definitely room for growth, though at an added cost of memory.

void setLine(int x0, int y0, int x1, int y1, int color); - Draws a line from x0,y0
to x1,y1. Color is a 12-bit RGB value.

void setRect(int x0, int y0, int x1, int y1, unsigned char fill, int color); - Draws
a rectangle with opposing corners at x0,y0 and x1,y1. A 1 for fill will fill the
entire rectangle, a 0 will only draw the border. Color is a 12-bit RGB value.

void printLogo(void); - One trick pony. Prints the SparkFun logo.

void on(void); - Turns the display on.

void off(void); - Turns the display off. You'll still see the backlight on!

About

This is an Arduino library for SparkFun's Color LCD Shield

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 69.9%
  • Java 30.1%