General Graphic Module

Collaboration diagram for General Graphic Module:


Modules

 Graphic Text Module
 Text Mode Module

LCD parameters

#define LCDGRAPH_INVERSE   0x01

Enumerations

enum  lcdgraph_type_e { LCDGRAPH_DOGM128_6 }
 LCD type. More...
enum  lcdgraph_result_e {
  LCDGRAPH_OK = 0, LCDGRAPH_TRANSMIT_FAIL, LCDGRAPH_PARAM_FAIL, LCDGRAPH_MEMORY_FAIL,
  LCDGRAPH_NOT_FOUND, LCDGRAPH_NOT_SUPPORTED, LCDGRAPH_OUT_OF_SCREEN, LCDGRAPH_FAIL
}
 Result. More...
enum  lcdgraph_fill_e {
  LCDGRAPH_FILL_NONE, LCDGRAPH_FILL_CLEAR, LCDGRAPH_FILL_SOLID, LCDGRAPH_FILL_HASH,
  LCDGRAPH_FILL_DOTS, LCDGRAPH_FILL_HORIZONTAL, LCDGRAPH_FILL_VERTICAL, LCDGRAPH_FILL_XOR
}
 Fill mode. More...

Functions

lcdgraph_result_e LCDGRAPH_Init (lcdgraph_type_e lcd_type, unsigned int lcd_mode)
 Initialization function.
void LCDGRAPH_GetVersion (unsigned char *major, unsigned char *minor)
 Function to get library version.
lcdgraph_result_e LCDGRAPH_Clear (void)
 Clear screen.
lcdgraph_result_e LCDGRAPH_DrawLine (unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2)
 Draws line.
lcdgraph_result_e LCDGRAPH_DrawRectangle (unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned char frame_width, lcdgraph_fill_e fill)
 Draws rectangle.
lcdgraph_result_e LCDGRAPH_GetMaxXY (unsigned int *max_x, unsigned int *max_y)
 Returns size of LCD display.
lcdgraph_result_e LCDGRAPH_SetBoundary (unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2)
 Set boundary.
lcdgraph_result_e LCDGRAPH_SetPixel (unsigned int x, unsigned int y, unsigned char new_state)
 Set or clear single pixel.

Define Documentation

#define LCDGRAPH_INVERSE   0x01

Set LCD display to inverse mode which means that all active pixels will be cleared and all inactive ones will be set


Enumeration Type Documentation

enum lcdgraph_fill_e

Fill mode.

Fill mode used to fill areas

Enumerator:
LCDGRAPH_FILL_NONE  No fill
LCDGRAPH_FILL_CLEAR  Fill area with empty pixels
LCDGRAPH_FILL_SOLID  Set every pixel of area
LCDGRAPH_FILL_HASH  Hash
LCDGRAPH_FILL_DOTS  Dots
LCDGRAPH_FILL_HORIZONTAL  Fill with horizontal lines
LCDGRAPH_FILL_VERTICAL  Fill with vertical lines
LCDGRAPH_FILL_XOR  Inverse area

enum lcdgraph_result_e

Result.

Code of return describing type of error occured

Enumerator:
LCDGRAPH_OK  No error occured
LCDGRAPH_TRANSMIT_FAIL  Hardware transmission to LCD was corrupted
LCDGRAPH_PARAM_FAIL  Wrong parameter value has been passed to the function
LCDGRAPH_MEMORY_FAIL  Error while trying to allocate memory for LCD purposes
LCDGRAPH_NOT_FOUND  Search item has not been found
LCDGRAPH_NOT_SUPPORTED  Required operation or LCD type is not supported by library
LCDGRAPH_OUT_OF_SCREEN  Coordinates refers to area outside of the screen
LCDGRAPH_FAIL  Operation error occured

enum lcdgraph_type_e

LCD type.

Describe LCD type

Enumerator:
LCDGRAPH_DOGM128_6  LCD DOGM128-6 (128x64)


Function Documentation

lcdgraph_result_e LCDGRAPH_Clear ( void   ) 

Clear screen.

Author:
Mariusz Murawski
Clears LCD's screen. If inverse mode is selected then all pixels will be displayed

Return values:
LCDGRAPH_OK if all is ok
LCDGRAPH_NOT_SUPPORTED if wrong LCD type was selected
LCDGRAPH_FAIL if something went wrong with operation

lcdgraph_result_e LCDGRAPH_DrawLine ( unsigned int  x1,
unsigned int  y1,
unsigned int  x2,
unsigned int  y2 
)

Draws line.

Author:
Mariusz Murawski
Draws line from point (x1, y1) to (x2, y2)

Parameters:
x1 coordinates of top left end
y1 coordinates of top left end
x2 coordinates of bottom right end
y2 coordinates of bottom right end
Return values:
LCDGRAPH_OK if all is ok
LCDGRAPH_NOT_SUPPORTED if wrong LCD type was selected
LCDGRAPH_OUT_OF_SCREEN if any coordinate refers to area outside of a screen
LCDGRAPH_FAIL if something went wrong with operation

lcdgraph_result_e LCDGRAPH_DrawRectangle ( unsigned int  x1,
unsigned int  y1,
unsigned int  x2,
unsigned int  y2,
unsigned char  frame_width,
lcdgraph_fill_e  fill 
)

Draws rectangle.

Author:
Mariusz Murawski
Draws rectangle with given frame width and fill type

Parameters:
x1 coordinates of top left corner
y1 coordinates of top left corner
x2 coordinates of bottom right corner
y2 coordinates of bottom right corner
frame_width width of rectangle's frame
fill type of fill
Return values:
LCDGRAPH_OK if all is ok
LCDGRAPH_NOT_SUPPORTED if wrong lcd type was selected
LCDGRAPH_FAIL if something went wrong with operation
LCDGRAPH_OUT_OF_SCREEN if any coordinate refers to area outside of a screen

lcdgraph_result_e LCDGRAPH_GetMaxXY ( unsigned int *  max_x,
unsigned int *  max_y 
)

Returns size of LCD display.

Author:
Mariusz Murawski
Returns maximum pixels in x and y axises

Parameters:
[out] max_x pointer to variable that will be loaded with maximum number of pixels in x. Pass NULL if this value is out of interest
[out] max_y pointer to variable that will be loaded with maximum number of pixels in y. Pass NULL if this value is out of interest
Return values:
LCDGRAPH_OK if all is ok

void LCDGRAPH_GetVersion ( unsigned char *  major,
unsigned char *  minor 
)

Function to get library version.

Author:
Mariusz Murawski
Returns library version number. For example, major=1, minor=0 -> version = 1.0

Parameters:
[out] major Major number
[out] minor Minor number

lcdgraph_result_e LCDGRAPH_Init ( lcdgraph_type_e  lcd_type,
unsigned int  lcd_mode 
)

Initialization function.

Author:
Mariusz Murawski
Performs initialization of specific LCD driver.

Parameters:
lcd_type Type of LCD to use
lcd_mode Mode of operation. Logic sum of defines: LCDGRAPH_INVERSE
Return values:
LCDGRAPH_OK if initialization was ok
LCDGRAPH_NOT_SUPPORTED if required lcd_type is not supported. The library must have been built without demanded lcd_type flag switched on
LCDGRAPH_FAIL if there were error during internal driver initialization

lcdgraph_result_e LCDGRAPH_SetBoundary ( unsigned int  x1,
unsigned int  y1,
unsigned int  x2,
unsigned int  y2 
)

Set boundary.

Author:
Mariusz Murawski
Set boundary. Nothing will be displayed outside rectangle (x1, y1)(x2, y2)

Parameters:
x1 
y1 
x2 
y2 
Return values:
LCDGRAPH_OK if all is ok
LCDGRAPH_NOT_SUPPORTED if wrong LCD type was selected
LCDGRAPH_FAIL if something went wrong with operation
LCDGRAPH_OUT_OF_SCREEN if any coordinate refers to area outside of a screen

lcdgraph_result_e LCDGRAPH_SetPixel ( unsigned int  x,
unsigned int  y,
unsigned char  new_state 
)

Set or clear single pixel.

Author:
Mariusz Murawski
Change state of single pixel at (x, y)

Parameters:
x coordinates
y coordinates
new_state 
  • 0 if pixel is to be cleared
  • 1 if pixel is to be set
If inverse mode was selected new_state will be inversed as well

Return values:
LCDGRAPH_OK if all is ok
LCDGRAPH_NOT_SUPPORTED if wrong LCD type was selected
LCDGRAPH_OUT_OF_SCREEN if coordinates refer to area outside of a screen
LCDGRAPH_FAIL if something went wrong with operation

SourceForge.net Logo