A C12832 LCD with generic interface

Dependents:   mbed_blinky HTTPClient_HelloWorld websocketandnode xbeerx ... more

Fork of C12832 by Chris Styles

Embed: (wiki syntax)

« Back to documentation index

C12832 Class Reference

The C12832 class. More...

#include <C12832.h>

Inherits GraphicsDisplay.

Public Member Functions

 C12832 (PinName mosi, PinName sck, PinName reset, PinName a0, PinName ncs, const char *name="LCD")
 Create a C12832 object connected to SPI1.
virtual int width ()
 Get the width of the screen in pixel.
virtual int height ()
 Get the height of the screen in pixel.
virtual void pixel (int x, int y, int colour)
 Draw a pixel at x,y black or white.
void circle (int x, int y, int r, int colour)
 Draw a circle.
void fillcircle (int x, int y, int r, int colour)
 Draw a filled circle.
void line (int x0, int y0, int x1, int y1, int colour)
 Draw a 1 pixel line.
void rect (int x0, int y0, int x1, int y1, int colour)
 Draw a rect.
void fillrect (int x0, int y0, int x1, int y1, int colour)
 Draw a filled rect.
void copy_to_lcd (void)
 Copy display buffer to LCD.
void set_contrast (unsigned int o)
 Set the orienation of the screen.
unsigned int get_contrast (void)
 Read the contrast level.
void invert (unsigned int o)
 Invert the screen.
virtual void cls (void)
 Clear the screen.
void setmode (int mode)
 Set the drawing mode.
virtual int columns (void)
 Return number if columns on TextDisplay\.
virtual int rows (void)
 Calculate the max number of columns.
virtual int _putc (int value)
 Put a char on the screen.
virtual void character (int x, int y, int c)
 Draw a character on given position out of the active font to the LCD.
virtual void locate (int x, int y)
 Setup cursor position.
void set_auto_up (unsigned int up)
 Setup auto update of screen.
unsigned int get_auto_up (void)
 Get status of the auto update function.
void set_font (unsigned char *f)
 Select the font to use.
void print_bm (Bitmap bm, int x, int y)
 Print bitmap to buffer.
virtual bool claim (FILE *stream)
 Redirect output from a stream (stoud, sterr) to display.

Data Fields

SPI _spi
 Vars.

Protected Member Functions

void hline (int x0, int x1, int y, int colour)
 Draw a horizontal line.
void vline (int y0, int y1, int x, int colour)
 Draw a vertical line.
void lcd_reset ()
 Init the C12832 LCD controller.
void wr_dat (unsigned char value)
 Write data to the LCD controller.
void wr_cmd (unsigned char value)
 Write a command the LCD controller.

Detailed Description

The C12832 class.

Definition at line 59 of file C12832.h.


Constructor & Destructor Documentation

C12832 ( PinName  mosi,
PinName  sck,
PinName  reset,
PinName  a0,
PinName  ncs,
const char *  name = "LCD" 
)

Create a C12832 object connected to SPI1.

Definition at line 31 of file C12832.cpp.


Member Function Documentation

int _putc ( int  value ) [virtual]

Put a char on the screen.

Parameters:
valuechar to print
Returns:
printed char

Reimplemented from TextDisplay.

Definition at line 470 of file C12832.cpp.

void character ( int  x,
int  y,
int  c 
) [virtual]

Draw a character on given position out of the active font to the LCD.

Parameters:
xx-position of char (top left)
yy-position
cchar to print

Implements TextDisplay.

Definition at line 485 of file C12832.cpp.

void circle ( int  x,
int  y,
int  r,
int  colour 
)

Draw a circle.

Parameters:
x0,y0center
rradius
color- 1 set pixel, 0 erase pixel

Definition at line 324 of file C12832.cpp.

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

Redirect output from a stream (stoud, sterr) to display.

Parameters:
streamstream that shall be redirected to the TextDisplay

Definition at line 65 of file TextDisplay.cpp.

void cls ( void   ) [virtual]

Clear the screen.

Reimplemented from TextDisplay.

Definition at line 204 of file C12832.cpp.

int columns ( void   ) [virtual]

Return number if columns on TextDisplay\.

number of rows

Implements TextDisplay.

Definition at line 456 of file C12832.cpp.

void copy_to_lcd ( void   )

Copy display buffer to LCD.

Definition at line 158 of file C12832.cpp.

void fillcircle ( int  x,
int  y,
int  r,
int  colour 
)

Draw a filled circle.

Parameters:
x0,y0center
rradius
color- 1 set pixel, 0 erase pixel

Use circle with different radius, Can miss some pixels

Definition at line 432 of file C12832.cpp.

void fillrect ( int  x0,
int  y0,
int  x1,
int  y1,
int  colour 
)

Draw a filled rect.

Parameters:
x0,y0top left corner
x1,y1down right corner
color- 1 set pixel, 0 erase pixel

Definition at line 299 of file C12832.cpp.

unsigned int get_auto_up ( void   )

Get status of the auto update function.

Returns:
if auto update is on

Definition at line 538 of file C12832.cpp.

unsigned int get_contrast ( void   )

Read the contrast level.

Definition at line 68 of file C12832.cpp.

int height (  ) [virtual]

Get the height of the screen in pixel.

Returns:
height of screen in pixel

Definition at line 47 of file C12832.cpp.

void hline ( int  x0,
int  x1,
int  y,
int  colour 
) [protected]

Draw a horizontal line.

Parameters:
x0horizontal start
x1horizontal stop
yvertical position
color- 1 set pixel, 0 erase pixel
void invert ( unsigned int  o )

Invert the screen.

Parameters:
o= 0 normal, 1 invert

Definition at line 54 of file C12832.cpp.

void lcd_reset (  ) [protected]

Init the C12832 LCD controller.

Definition at line 96 of file C12832.cpp.

void line ( int  x0,
int  y0,
int  x1,
int  y1,
int  colour 
)

Draw a 1 pixel line.

Parameters:
x0,y0start point
x1,y1stop point
color- 1 set pixel, 0 erase pixel

Definition at line 211 of file C12832.cpp.

void locate ( int  x,
int  y 
) [virtual]

Setup cursor position.

Parameters:
xx-position (top left)
yy-position

Reimplemented from TextDisplay.

Definition at line 448 of file C12832.cpp.

void pixel ( int  x,
int  y,
int  colour 
) [virtual]

Draw a pixel at x,y black or white.

Parameters:
xhorizontal position
yvertical position
color- 1 set pixel, 0 erase pixel

Definition at line 140 of file C12832.cpp.

void print_bm ( Bitmap  bm,
int  x,
int  y 
)

Print bitmap to buffer.

Parameters:
bmBitmap in flash
xx start
yy start

Definition at line 543 of file C12832.cpp.

void rect ( int  x0,
int  y0,
int  x1,
int  y1,
int  colour 
)

Draw a rect.

Parameters:
x0,y0top left corner
x1,y1down right corner
color- 1 set pixel, 0 erase pixel

Definition at line 281 of file C12832.cpp.

int rows ( void   ) [virtual]

Calculate the max number of columns.

Depends on actual font size

Returns:
max column

Implements TextDisplay.

Definition at line 463 of file C12832.cpp.

void set_auto_up ( unsigned int  up )

Setup auto update of screen.

Parameters:
up1 = on , 0 = off

if switched off the program has to call copy_to_lcd() to update screen from framebuffer

Definition at line 532 of file C12832.cpp.

void set_contrast ( unsigned int  o )

Set the orienation of the screen.

Definition at line 61 of file C12832.cpp.

void set_font ( unsigned char *  f )

Select the font to use.

Parameters:
fpointer to font array

font array can created with GLCD Font Creator from http://www.mikroe.com you have to add 4 parameter at the beginning of the font array to use:

  • the number of byte / char
  • the vertial size in pixel
  • the horizontal size in pixel
  • the number of byte per vertical line you also have to change the array to char[]

Definition at line 527 of file C12832.cpp.

void setmode ( int  mode )

Set the drawing mode.

Parameters:
modeNORMAl or XOR

Definition at line 443 of file C12832.cpp.

void vline ( int  y0,
int  y1,
int  x,
int  colour 
) [protected]

Draw a vertical line.

Parameters:
xhorizontal position
y0vertical start
y1vertical stop
color- 1 set pixel, 0 erase pixel
int width (  ) [virtual]

Get the width of the screen in pixel.

Returns:
width of screen in pixel

Definition at line 41 of file C12832.cpp.

void wr_cmd ( unsigned char  value ) [protected]

Write a command the LCD controller.

Parameters:
cmd,:command to be written

Definition at line 76 of file C12832.cpp.

void wr_dat ( unsigned char  value ) [protected]

Write data to the LCD controller.

Parameters:
datdata written to LCD controller

Definition at line 86 of file C12832.cpp.


Field Documentation

SPI _spi

Vars.

Definition at line 227 of file C12832.h.