Demo Application for the Celeritous Breakout Board

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

ST7565R Class Reference

ST7565R Display Driver; uses some code taken from the TextLCD driver for displaying text. More...

#include <ST7565R.h>

Public Member Functions

 ST7565R (PinName cs, PinName a0, PinName scl, PinName si, PinName rst, bool BackBuffer)
 Create a ST7565R display object on the pins specified.
void moveto (int col, int row)
 Function to move the text cursor to where specified; DISCLAIMER: All text routines are based on code from TextLCD, who's link is in the cookbook.
void command (int value)
 Function to send a command byte to the display.
void data (int value)
 Function to send display data to the display.
void reset ()
 Function that uses the reset line and then reinitializes the display as well as clearing the current buffer.
void setpixel (int x, int y)
 Function to set a specific pixel to black.
void clearpixel (int x, int y)
 Function to set a specific pixel to white.
char * getDrawingScreen ()
 Function to get the buffer being used inside the object to do bit writes, required because of the lack of reading screen data back over spi for the ST7565R.
char * getCurrentScreen ()
 Function to get the buffer being used inside the object to do bit writes, required because of the lack of reading screen data back over spi for the ST7565R.
void clearBuffer ()
 Function to clear the current drawing buffer.
void swapBuffers ()
 Function to commit all the data to the drawing buffer, then calls the display command to change buffers so as to not promote a flicker in the display.
void bitblt (int dstx, int dsty, int blit_width, int blit_height, char *img, int img_width, int img_height, int srcx, int srcy, int format)
 Function to blit an image to the screen.
void character (int column, int row, char c)
 Function to place a character on the screen.
int columns ()
 Function to return the number of columns; for now all it does is returns 21.
int rows ()
 Function to return the number of rows; for now all it does is returns 4.
void setTextMode (int mode)
 Function to set the font being used to print to the screen; Note: this changes the number of row and columns as well.

Protected Member Functions

virtual int _putc (int value)
 Overwritten function from the Stream object.
virtual int _getc ()
 Overwritten function from the Stream object.

Detailed Description

ST7565R Display Driver; uses some code taken from the TextLCD driver for displaying text.

Example:

 #include "ST7565R.h"
 #include "mbed.h"

 ST7565R lcd(p12,p29,p7,p5, p30 , false);
 
 int main() { 
   lcd.printf("Hello world!");
 }

Definition at line 55 of file ST7565R.h.


Constructor & Destructor Documentation

ST7565R ( PinName  cs,
PinName  a0,
PinName  scl,
PinName  si,
PinName  rst,
bool  BackBuffer 
)

Create a ST7565R display object on the pins specified.

Parameters:
csThe chip select pin for the display.
a0The data/read select line for the display; specified as A0 in the datasheet.
sclThe clock pin for SPI.
rstThe reset pin on the display.
BackBufferThe display I have has a memory area thats can be used for backbuffering. This turns this option on. When using this option you must call swapBuffers() in order to display your changes to the screen. This is to help prevent flickering on the display. If not using a backbuffer all writes using bitblt or setpixel are immediate and visible to the screen.

Definition at line 5 of file ST7565R.cpp.


Member Function Documentation

int _getc (  ) [protected, virtual]

Overwritten function from the Stream object.

DISCLAIMER: All text routines are based on code from TextLCD, who's link is in the cookbook.

Definition at line 97 of file ST7565R.cpp.

int _putc ( int  value ) [protected, virtual]

Overwritten function from the Stream object.

DISCLAIMER: All text routines are based on code from TextLCD, who's link is in the cookbook.

Definition at line 64 of file ST7565R.cpp.

void bitblt ( int  dstx,
int  dsty,
int  blit_width,
int  blit_height,
char *  img,
int  img_width,
int  img_height,
int  srcx,
int  srcy,
int  format 
)

Function to blit an image to the screen.

Used internally for copying the font to the screen, but also is powerful for displaying any monochrome image.

Parameters:
dstxThe x coordinate destination on the screen you want to blit to.
dstyThe y coordinate destination on the screen you want to blit to.
blit_widthThe width of the image copy you want to perform.
blit_heightThe height of the image copy you want to perform.
imgThe pointer to the data of the image.
img_widthThe width of the image. Required for calculating the address to start the next line in the img buffer.
img_heightThe height of the image.
srcxThe x coordinate where to start copying image data from within the source image.
srcyThe y coordinate where to start copying image data from within the source image
formatWhat kind of copy to perform. BITBLT_SRCCOPY is a standard image copy.

Definition at line 194 of file ST7565R.cpp.

void character ( int  column,
int  row,
char  c 
)

Function to place a character on the screen.

DISCLAIMER: All text routines are based on code from TextLCD, who's link is in the cookbook.

Parameters:
columnThe column number. With the font in Text.h this number is 21 and can be retrieved from columns()
rowThe row number. With the font in Text.h this number is 4 and can be retrieved from rows()

Definition at line 46 of file ST7565R.cpp.

void clearBuffer (  )

Function to clear the current drawing buffer.

This clears the current screen when not using a backbuffer.

Definition at line 102 of file ST7565R.cpp.

void clearpixel ( int  x,
int  y 
)

Function to set a specific pixel to white.

Parameters:
xMeasured from the top left of the display; If the display is in backbuffering mode the pixel change is completely within the offscreen buffer and won't display until swapBuffer() is called.
yMeasured from the top left of the display; If the display is in backbuffering mode the pixel change is completely within the offscreen buffer and won't display until swapBuffer() is called.

Definition at line 132 of file ST7565R.cpp.

int columns (  )

Function to return the number of columns; for now all it does is returns 21.

Reserved for possible later code manipulation with multiple fonts. DISCLAIMER: All text routines are based on code from TextLCD, who's link is in the cookbook.

Definition at line 91 of file ST7565R.cpp.

void command ( int  value )

Function to send a command byte to the display.

Parameters:
valueThe command byte to send over spi.

Definition at line 158 of file ST7565R.cpp.

void data ( int  value )

Function to send display data to the display.

Parameters:
valueThe data byte to send over spi. Memory is arranged in pages. A data write will cover 8 pixels vertically (the page) and only one column. A data write will increment the column by 1 but will never increment the page.

Definition at line 150 of file ST7565R.cpp.

char* getCurrentScreen (  )

Function to get the buffer being used inside the object to do bit writes, required because of the lack of reading screen data back over spi for the ST7565R.

The buffer returned is the one that has the current screen data on it. Without backbuffering mode this returns the current screen.

char * getDrawingScreen (  )

Function to get the buffer being used inside the object to do bit writes, required because of the lack of reading screen data back over spi for the ST7565R.

The buffer returned is the one that you can draw to without immediately updating the screen.

Definition at line 187 of file ST7565R.cpp.

void moveto ( int  col,
int  row 
)

Function to move the text cursor to where specified; DISCLAIMER: All text routines are based on code from TextLCD, who's link is in the cookbook.

Parameters:
colThe column number. With the font in Text.h this number is 21 and can be retrieved from columns()
rowThe chip select pin for the display.

Definition at line 41 of file ST7565R.cpp.

void reset ( void   )

Function that uses the reset line and then reinitializes the display as well as clearing the current buffer.

Definition at line 21 of file ST7565R.cpp.

int rows (  )

Function to return the number of rows; for now all it does is returns 4.

Reserved for possible later code manipulation with multiple fonts. DISCLAIMER: All text routines are based on code from TextLCD, who's link is in the cookbook.

Definition at line 85 of file ST7565R.cpp.

void setpixel ( int  x,
int  y 
)

Function to set a specific pixel to black.

Parameters:
xMeasured from the top left of the display; If the display is in backbuffering mode the pixel change is completely within the offscreen buffer and won't display until swapBuffer() is called.
yMeasured from the top left of the display; If the display is in backbuffering mode the pixel change is completely within the offscreen buffer and won't display until swapBuffer() is called.

Definition at line 114 of file ST7565R.cpp.

void setTextMode ( int  mode )

Function to set the font being used to print to the screen; Note: this changes the number of row and columns as well.

Definition at line 17 of file ST7565R.cpp.

void swapBuffers (  )

Function to commit all the data to the drawing buffer, then calls the display command to change buffers so as to not promote a flicker in the display.

Not needed if not using a backbuffer.

Definition at line 166 of file ST7565R.cpp.