uOLED Class Reference

Base uOLED class. More...

#include <uOLED.h>

List of all members.

Public Member Functions

 uOLED (void)
 Class constructor.
void begin (int pin, long baud, HardwareSerial *serialToUse)
 Start and init screen.
void PutPixel (char x, char y, int color)
 Draw a pixel.
void Line (char x1, char y1, char x2, char y2, int color)
 Draw a line.
void Rectangle (char x1, char y1, char x2, char y2, int color, char filled)
 Draw a rectangle.
void Circle (char x, char y, char radius, int color, char filled)
 Draw a circle.
void SetBackColor (int color)
 Set background color.
void Triangle (char x1, char y1, char x2, char y2, char x3, char y3, int color, char filled)
 Draw a triangle.
void CopyPaste (char xCopy, char yCopy, char xPaste, char yPaste, char Width, char Height)
 Copy and paste a rectangle on screen.
void Character (char Character, char font, char col, char row, int color, char transparent)
 Place a character on the screen.
void CharacterGraphic (char Character, char font, char col, char row, int color, char Width, char Height, char transparent)
 Place a scaled character on the screen.
void Text (char col, char row, char font, int color, char *Text, char transparent)
 Place a string of characters on the screen.
void TextGraphic (char col, char row, char font, int color, char Width, char Height, char *text, char transparent)
 Place a scaled string of characters on the screen.
void TextButton (char state, char x, char y, int ButtonColor, char font, int TextColor, char TextWidth, char TextHeight, char *Text)
 To do.
void AddBMPChar (char reference, char data1, char data2, char data3, char data4, char data5, char data6, char data7, char data8)
 To do.
void PutBMPChar (char reference, char x, char y, int color)
 To do.
unsigned int ReadPixel (char x, char y)
 To do.
void Cls (void)
 To do.
void DisplayControl (char Mode, char Value)
 To do.
void SetContrast (char contrastValue)
 To do.
void SetPowerState (char state)
 To do.
void SetDisplayState (char state)
 To do.
void DeviceInfo ()
 To do.
void scrollEnable (boolean enable)
 To do.
void scrollToRight (boolean toRight)
 To do.
void scrollSpeed (byte scrollSpeed)
 To do.
void sdInit ()
 To do.
void sdSetMemAdrr (char Umsb, char Ulsb, char Lmsb, char Llsb)
 To do.
void sdWriteByte (byte data)
 To do.
byte sdReadByte (void)
 To do.
void sdWriteBlock (long sector, byte data[])
 To do.
void sdReadBlock (long sector, byte data[])
 To do.
void sdScreenCopy (byte x, byte y, byte width, byte height, long sector)
 To do.
void sdDisplayImage (byte x, byte y, byte width, byte height, boolean twoBytesPP, long sector)
 To do.
void sdDisplayVideo (byte x, byte y, byte width, byte height, boolean twoBytesPP, byte fdelay, int frames, long sector)
 To do.
void playTone (int tone, int duration)
 Generate a note or frequency for a certain duration.
void playRtttl (char *song)
 To do.

Public Attributes

int PinReset
 Pin that send Reset signal.
char res
 Result for every command.
int x_res
 width of display in pixels
int y_res
 Height of display in pixels.

Private Member Functions

void write (byte pData)
 Wrapper for writing to serial port.
void begin (long BaudRate)
 Wrapper for Serial.begin(baudrate).
boolean available (void)
 Wrapper for checking if there is something to read from the serial buffer.
int read (void)
 Wrapper for reading from the serial port buffer.
void SetFontSize (char font)
 Setting the fontsize to use.
void TextMode (char mode)
 Setting opaque or transparent for text.
void PenSize (char size)
 Draw an object solid or wire-frame.
char RBack (void)
 Read back a character from the display.
void DevInfoInVar (void)
 Asks the display for it's geometry.

Private Attributes

HardwareSerial * pSerial
 Hardware serial port to use.

Detailed Description

Base uOLED class.

Base uOLED class with most functions from the manual

Definition at line 144 of file uOLED.h.


Constructor & Destructor Documentation

uOLED::uOLED ( void   ) 

Class constructor.

Definition at line 11 of file uOLED.cpp.


Member Function Documentation

void uOLED::AddBMPChar ( char  reference,
char  data1,
char  data2,
char  data3,
char  data4,
char  data5,
char  data6,
char  data7,
char  data8 
)

To do.

Longer text to do.

Definition at line 285 of file uOLED.cpp.

boolean uOLED::available ( void   )  [private]

Wrapper for checking if there is something to read from the serial buffer.

Definition at line 44 of file uOLED.cpp.

void uOLED::begin ( long  BaudRate  )  [private]

Wrapper for Serial.begin(baudrate).

Definition at line 39 of file uOLED.cpp.

void uOLED::begin ( int  pin,
long  baud,
HardwareSerial *  serialToUse 
)

Start and init screen.

begin takes 3 arguments.

  • int pin.
    Pinnumber connected to the reset line of the display
  • long baud.
    Baudrate to use for the serial connection to the display
  • HardwareSerial *serialToUse.
    Which hardware serial port to use. On a Arduino the options are
    &Serial, &Serial1, &Serial2 and &serial3.

Definition at line 13 of file uOLED.cpp.

void uOLED::Character ( char  Character,
char  font,
char  col,
char  row,
int  color,
char  transparent 
)

Place a character on the screen.

Places one character on the screen with a fontsize (0x00, 0x01 or 0x02) using column and row as reference. Color or is a 16bit color and argument 'transparant' takes;
either blocked(opaque) (0x01) or transparent (0x00).
From datasheet for 160 by 128 pixels;

column : horizontal position of character:
range : 0 - 20 for 5x7 font.
range : 0 - 15 for 8x8 and 8x12 font.

row : vertical position of character:
range : 0 - 15 for 5x7 and 8x8 font.
range : 0 - 9 for 8x12 font.

Definition at line 192 of file uOLED.cpp.

void uOLED::CharacterGraphic ( char  Character,
char  font,
char  col,
char  row,
int  color,
char  Width,
char  Height,
char  transparent 
)

Place a scaled character on the screen.

Place one scaled character on the screen with a chosen font (0x00, 0x01 or 0x02) referenced by column/row.
From datasheet for 160 by 128 pixels;

column : horizontal position of character:
range : 0 - 20 for 5x7 font.
range : 0 - 15 for 8x8 and 8x12 font.

row : vertical position of character:
range : 0 - 15 for 5x7 and 8x8 font.
range : 0 - 9 for 8x12 font.

With a 16bit color.
Width and Height are multipliers.
Example;

  • font used is 0x00 (5 by 7 pixels)
  • width and height are 2
    The result will be a character 10 by 14 pixels. Note that the column/row reference is still using 5 by 7 pixels.

Definition at line 207 of file uOLED.cpp.

void uOLED::Circle ( char  x,
char  y,
char  radius,
int  color,
char  filled 
)

Draw a circle.

Draw a circle with the center at x,y with a radius. 16bit color. Filled in that color or not.

Definition at line 128 of file uOLED.cpp.

void uOLED::Cls ( void   ) 

To do.

Longer text to do.

Definition at line 55 of file uOLED.cpp.

void uOLED::CopyPaste ( char  xCopy,
char  yCopy,
char  xPaste,
char  yPaste,
char  Width,
char  Height 
)

Copy and paste a rectangle on screen.

Copies a rectangle with top-left corner at xCopy,yCopy with a width and heighth to (top-left corner) xPaste,yPaste.

Definition at line 166 of file uOLED.cpp.

void uOLED::DeviceInfo (  ) 

To do.

Longer text to do.

Definition at line 362 of file uOLED.cpp.

void uOLED::DevInfoInVar ( void   )  [private]

Asks the display for it's geometry.

Puts the horizontal/vertical sizes of the display used in variables int x_res and int y_res.

Definition at line 372 of file uOLED.cpp.

void uOLED::DisplayControl ( char  Mode,
char  Value 
)

To do.

Longer text to do.

Definition at line 311 of file uOLED.cpp.

void uOLED::Line ( char  x1,
char  y1,
char  x2,
char  y2,
int  color 
)

Draw a line.

Place a line starting at x1,y1 ending at x2,y2 with 16bit color

Definition at line 94 of file uOLED.cpp.

void uOLED::PenSize ( char  size  )  [private]

Draw an object solid or wire-frame.

00hex : All graphics objects are drawn solid. 01hex : All graphics objects are drawn wire-frame

Definition at line 107 of file uOLED.cpp.

void uOLED::playRtttl ( char *  song  ) 

To do.

Longer text to do.

Definition at line 591 of file uOLED.cpp.

void uOLED::playTone ( int  tone,
int  duration 
)

Generate a note or frequency for a certain duration.

0 : No sound, silence.
1-84 : 5 octaves piano range + 2 more.
100-20000 : Frequency in Hz.

Definition at line 580 of file uOLED.cpp.

void uOLED::PutBMPChar ( char  reference,
char  x,
char  y,
int  color 
)

To do.

Longer text to do.

Definition at line 300 of file uOLED.cpp.

void uOLED::PutPixel ( char  x,
char  y,
int  color 
)

Draw a pixel.

Place a pixel at x,y coordinates with 16bit color

Place a pixel with color on width x and hight y.

Definition at line 83 of file uOLED.cpp.

char uOLED::RBack ( void   )  [private]

Read back a character from the display.

Puts the readed character from the display in char res;

Obtain result for every command that send Arduino to uOLED

Definition at line 64 of file uOLED.cpp.

int uOLED::read ( void   )  [private]

Wrapper for reading from the serial port buffer.

Definition at line 49 of file uOLED.cpp.

unsigned int uOLED::ReadPixel ( char  x,
char  y 
)

To do.

Longer text to do.

Definition at line 320 of file uOLED.cpp.

void uOLED::Rectangle ( char  x1,
char  y1,
char  x2,
char  y2,
int  color,
char  filled 
)

Draw a rectangle.

Draw a rectangle with upper-left corner at x1,y1 and the bottom-right corner at x2,y2. Lines will have 16bit color. filled=true -> fill the rectangle with the color given.
Note that the sides of the rectangle can not be diagonal on the screen.

Definition at line 114 of file uOLED.cpp.

void uOLED::scrollEnable ( boolean  enable  ) 

To do.

Longer text to do.

Definition at line 543 of file uOLED.cpp.

void uOLED::scrollSpeed ( byte  scrollSpeed  ) 

To do.

Longer text to do.

Definition at line 561 of file uOLED.cpp.

void uOLED::scrollToRight ( boolean  toRight  ) 

To do.

Longer text to do.

Definition at line 552 of file uOLED.cpp.

void uOLED::sdDisplayImage ( byte  x,
byte  y,
byte  width,
byte  height,
boolean  twoBytesPP,
long  sector 
)

To do.

Longer text to do.

Definition at line 502 of file uOLED.cpp.

void uOLED::sdDisplayVideo ( byte  x,
byte  y,
byte  width,
byte  height,
boolean  twoBytesPP,
byte  fdelay,
int  frames,
long  sector 
)

To do.

Longer text to do.

Definition at line 521 of file uOLED.cpp.

void uOLED::sdInit (  ) 

To do.

Longer text to do.

Definition at line 430 of file uOLED.cpp.

void uOLED::sdReadBlock ( long  sector,
byte  data[] 
)

To do.

Longer text to do.

Definition at line 477 of file uOLED.cpp.

byte uOLED::sdReadByte ( void   ) 

To do.

Longer text to do.

Definition at line 457 of file uOLED.cpp.

void uOLED::sdScreenCopy ( byte  x,
byte  y,
byte  width,
byte  height,
long  sector 
)

To do.

Longer text to do.

Definition at line 488 of file uOLED.cpp.

void uOLED::sdSetMemAdrr ( char  Umsb,
char  Ulsb,
char  Lmsb,
char  Llsb 
)

To do.

Longer text to do.

Definition at line 438 of file uOLED.cpp.

void uOLED::sdWriteBlock ( long  sector,
byte  data[] 
)

To do.

Longer text to do.

Definition at line 464 of file uOLED.cpp.

void uOLED::sdWriteByte ( byte  data  ) 

To do.

Longer text to do.

Definition at line 449 of file uOLED.cpp.

void uOLED::SetBackColor ( int  color  ) 

Set background color.

Set the 16bits background color. Using this command will fill the screen with the chosen color. All pixels on screen that have the same color wil 'disappear'.

Definition at line 142 of file uOLED.cpp.

void uOLED::SetContrast ( char  contrastValue  ) 

To do.

Longer text to do.

Definition at line 335 of file uOLED.cpp.

void uOLED::SetDisplayState ( char  state  ) 

To do.

Longer text to do.

Definition at line 353 of file uOLED.cpp.

void uOLED::SetFontSize ( char  font  )  [private]

Setting the fontsize to use.

By default (no custom fonts created with font-tool) the options are;
SMALL_FONT 0x00, MEDIUM_FONT 0x01 and LARGE_FONT 0x02

Definition at line 178 of file uOLED.cpp.

void uOLED::SetPowerState ( char  state  ) 

To do.

Longer text to do.

Definition at line 344 of file uOLED.cpp.

void uOLED::Text ( char  col,
char  row,
char  font,
int  color,
char *  Text,
char  transparent 
)

Place a string of characters on the screen.

Places a string of characters on the screen with a fontsize (0x00, 0x01 or 0x02) using column and row as reference for the first character. Maximum string size is 256 characters and the display will wrap around to the next row. Color or is a 16bit color and argument 'transparant' takes;
either blocked (0x01) or transparent (0x00).
From datasheet for 160 by 128 pixels;

column : horizontal position of first character:
range : 0 - 20 for 5x7 font.
range : 0 - 15 for 8x8 and 8x12 font.

row : vertical position of first character:
range : 0 - 15 for 5x7 and 8x8 font.
range : 0 - 9 for 8x12 font.

Definition at line 224 of file uOLED.cpp.

void uOLED::TextButton ( char  state,
char  x,
char  y,
int  ButtonColor,
char  font,
int  TextColor,
char  TextWidth,
char  TextHeight,
char *  Text 
)

To do.

Longer text to do.

Definition at line 262 of file uOLED.cpp.

void uOLED::TextGraphic ( char  col,
char  row,
char  font,
int  color,
char  Width,
char  Height,
char *  text,
char  transparent 
)

Place a scaled string of characters on the screen.

Place a scaled string of characters on the screen with a chosen font (0x00, 0x01 or 0x02). First character referenced by column/row.
From datasheet for 160 by 128 pixels;

column : horizontal position of character:
range : 0 - 20 for 5x7 font.
range : 0 - 15 for 8x8 and 8x12 font.

row : vertical position of character:
range : 0 - 15 for 5x7 and 8x8 font.
range : 0 - 9 for 8x12 font.

With a 16bit color.
Width and Height are multipliers.
Example;

  • font used is 0x00 (5 by 7 pixels)
  • width and height are 2
    The result will be a character 10 by 14 pixels. Note that the column/row reference is still using 5 by 7 pixels.

Definition at line 242 of file uOLED.cpp.

void uOLED::TextMode ( char  mode  )  [private]

Setting opaque or transparent for text.

An object behind the text can either be blocked (0x01) or transparent (0x00).

Definition at line 185 of file uOLED.cpp.

void uOLED::Triangle ( char  x1,
char  y1,
char  x2,
char  y2,
char  x3,
char  y3,
int  color,
char  filled 
)

Draw a triangle.

Draw a triangle with corners x1,y1, x2,y2 and x3,y3 with specified color, filled or not.
Note from datasheet; The vertices must be specified in an anti-clock wise manner,
i.e. x2 < x1 : x3 > x2 : y2 > y1 : y3 > y1

Definition at line 150 of file uOLED.cpp.

void uOLED::write ( byte  pData  )  [private]

Wrapper for writing to serial port.

Definition at line 34 of file uOLED.cpp.


Member Data Documentation

Pin that send Reset signal.

Definition at line 165 of file uOLED.h.

HardwareSerial* uOLED::pSerial [private]

Hardware serial port to use.

On a Arduino Mega the options are
&Serial, &Serial1, &Serial2 and &serial3.

Definition at line 468 of file uOLED.h.

char uOLED::res

Result for every command.

Readable as a variable in your sketch

Definition at line 171 of file uOLED.h.

width of display in pixels

Readable as a variable in your sketch

Definition at line 177 of file uOLED.h.

Height of display in pixels.

Readable as a variable in your sketch

Definition at line 183 of file uOLED.h.


The documentation for this class was generated from the following files:
Generated on Mon Mar 29 15:31:47 2010 for uoled_library_JB by  doxygen 1.6.3