Arduino openGLCD Library  Version v1.0rc3
 All Classes Functions Variables Enumerations Enumerator Groups Pages
glcd_Device Class Reference

Low level device functions. More...

+ Inheritance diagram for glcd_Device:

Protected Member Functions

void GotoXY (uint8_t x, uint8_t y)
 set current x,y coordinate on display device More...
 
int Init (glcd_device_mode invert=NON_INVERTED)
 Low level h/w initialization of library and display. More...
 
int Off (void)
 Turn off the display & backlight. More...
 
int OffBacklight (void)
 Turn off the backlight. More...
 
int OffDisplay (void)
 Turn the display pixels off. More...
 
int On (void)
 Turn on the display & backlight. More...
 
int OnBacklight (void)
 Turn on the backlight. More...
 
int OnDisplay (void)
 Turn the display pixels on. More...
 
uint8_t ReadData (void)
 read a data byte from display device memory More...
 
int SetBacklight (int val)
 Set backlight brightness. More...
 
void SetDot (uint8_t x, uint8_t y, uint8_t color)
 set pixel at x,y to the given color More...
 
void SetPixels (uint8_t x, uint8_t y, uint8_t x1, uint8_t y1, uint8_t color)
 set an area of pixels More...
 
void WriteData (uint8_t data)
 Write a byte to display device memory. More...
 

Detailed Description

Low level device functions.

Member Function Documentation

void GotoXY ( uint8_t  x,
uint8_t  y 
)
protected

set current x,y coordinate on display device

Parameters
xX coordinate
yY coordinate

Sets the current pixel location to x,y. x and y are relative to the 0,0 origin of the display which is the upper left most pixel on the display.

int Init ( glcd_device_mode  invert = NON_INVERTED)
protected

Low level h/w initialization of library and display.

Parameters
invertspecifices whether display is in normal mode or inverted mode.

This should be called prior to any other graphic library function. It does all the needed initializations including taking care of the low level hardware initalization of the display device.

The optional invert parameter specifies if the display should be run in a normal mode, or inverted mode.
It does not refer to whether the display uses light or darg pixels.

In "normal" or NON_INVERTED mode, pixels are turned on for PIXEL_ON or BLACK and turned off for PIXEL_OFF or WHITE.

In "inverted" or INVERTED mode, pixels are turned off for PIXEL_ON or BLACK and turned on for PIXEL_OFF or WHITE.

NON_INVERTED mode clears the display with all pixels off and drawing with PIXEL_ON or BLACK will turn on pixels.

INVERTED mode clears the display with all pixels on and drawing with PIXEL_OFF or WHITE will turn on pixels.

The terminology of BLACK and WHITE is from the perspective of a display that uses black pixels on a light background. For example, if a pixel is set to BLACK and used on a black pixel on light background display, you get a black pixel.
However, if the display is a white pixel on dark background display, then setting a pixel to BLACK turns on a white pixel on the display.

Because of this, it can be less confusing to use PIXEL_ON and PIXEL_OFF vs BLACK and WHITE.

Upon successful completion of the initialization:

  • the display pixels will be enabled
  • the backlight will be turned on (if configured)
  • the entire display will be cleared
  • the x,y postion will be set to 0,0
Returns
0 or GLCD_NOERR when successful or non zero error code when unsucessful
Note
This function can also be called to re-initliaze the display hardware.
int Off ( void  )
protected

Turn off the display & backlight.

Turns off the display's pixels and backlight

Returns
0 or GLCD_NOERR when successful or non zero error code when unsucessful
See also
On()
OffDisplay()
OffBacklight()
int OffBacklight ( void  )
protected

Turn off the backlight.

Returns
0 or GLCD_NOERR when successful or non zero error code when unsucessful
See also
OnBacklight()
OffDisplay()
Off()
int OffDisplay ( void  )
protected

Turn the display pixels off.

Turns off the display pixels. It does not alter or modify the backlight setting. If the display backlight is on, it will remain on.

Returns
0 or GLCD_NOERR when successful or non zero error code when unsucessful
See also
OnDisplay()
OffBacklight()
Off()
int On ( void  )
protected

Turn on the display & backlight.

Turns on the display's pixels and backlight

Returns
0 or GLCD_NOERR when successful or non zero error code when unsucessful
Note
The backlight will be turned on at full intensity
See also
Off()
OnDisplay()
OnBacklight()
int OnBacklight ( void  )
protected

Turn on the backlight.

Returns
0 or GLCD_NOERR when successful or non zero error code when unsucessful
See also
OffBacklight()
OnDisplay()
On()
int OnDisplay ( void  )
protected

Turn the display pixels on.

Turns on the display pixels. It does not alter or modify the backlight setting.

Returns
0 or GLCD_NOERR when successful or non zero error code when unsucessful
See also
OffDisplay()
OnBacklight()
On()
uint8_t ReadData ( void  )
protected

read a data byte from display device memory

Returns
the data byte at the current x,y position
Note
the current x,y location is not modified by the routine. This allows a read/modify/write operation. Code can call ReadData() modify the data then call WriteData() and update the same location.
See also
WriteData()
int SetBacklight ( int  val)
protected

Set backlight brightness.

Parameters
valbacklight brightness (0-255)

If the display circuitry only has the option to turn the backlight on and off then any non zero value will turn the display on with maximum brightness The value HIGH should not be used to turn the backlight on since this function is used to control backlight intensity and not for on / off control. A value of HIGH is typically 1 which would be a very dim backlight.

Returns
0 or GLCD_NOERR when successful or non zero error code when unsucessful
See also
OnBacklight() OffBacklight()
Note
Currently dimming is not yet supported.
void SetDot ( uint8_t  x,
uint8_t  y,
uint8_t  color 
)
protected

set pixel at x,y to the given color

Parameters
xX coordinate, a value from 0 to GLCD.Width-1
yY coordinate, a value from 0 to GLCD.Heigh-1
colorSets the pixel at location x,y to the specified color. x and y are relative to the 0,0 origin of the display which is the upper left corner. Requests to set pixels outside the range of the display will be ignored.
Note
If the display has been set to INVERTED mode then the color will be automically reversed.
void SetPixels ( uint8_t  x,
uint8_t  y,
uint8_t  x2,
uint8_t  y2,
uint8_t  color 
)
protected

set an area of pixels

Parameters
xX coordinate of upper left corner
yY coordinate of upper left corner
x2X coordinate of lower right corner
y2Y coordinate of lower right corner
colorsets the pixels an area bounded by x,y to x2,y2 inclusive to the specified color. x,y is the upper left corner and x2,y2 is the lower left corner.

The width of the area is x2-x + 1. The height of the area is y2-y+1

void WriteData ( uint8_t  data)
protected

Write a byte to display device memory.

Parameters
datadate byte to write to memory

The data specified is written to glcd memory at the current x,y position. If the y location is not on a byte boundary, the write is fragemented up into multiple writes.

Note
the full behavior of this during split byte writes currently varies depending on a compile time define. The code can be configured to either OR in 1 data bits or set all the data bits. TRUE_WRITE controls this behavior.
the x,y address will not be the same as it was prior to this call. The y address will remain the aame but the x address will advance by one. This allows back to writes to write sequentially through memory without having to do additional x,y positioning.
See also
ReadData()

The documentation for this class was generated from the following files: