upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Public Member Functions | Protected Member Functions
EBOLED Class Reference

API for EBOLED spi controlled OLED display. More...

Detailed Description

The EBOLED is an ssd1306 with some modifications to work as an Edison Block. It is a 64x48 pixel OLED display that connects directly to an edison via it's 80-pin connector. Edison Blocks are stackable modules created by Sparkfun.

This block has some buttons on it that can be accessed using standard GPIO – this driver only concerns itself with the display.

eboled.jpg


OLED Sensor image provided by SparkFun* under CC BY-NC-SA-3.0.

// Instantiate an Edison Block OLED using default values
upm::EBOLED *lcd = new upm::EBOLED();
lcd->clear();
lcd->setCursor(10, 15);
lcd->write("Hello");
lcd->setCursor(30, 15);
lcd->write("World!");
lcd->refresh();
cout << "Sleeping for 5 seconds..." << endl;
sleep(5);
delete lcd;

Public Member Functions

 EBOLED (int spi=EBOLED_DEFAULT_SPI_BUS, int CD=EBOLED_DEFAULT_CD, int reset=EBOLED_DEFAULT_RESET)
 
 ~EBOLED ()
 
mraa::Result refresh ()
 
mraa::Result write (std::string msg)
 
mraa::Result setCursor (int row, int column)
 
void setTextColor (uint8_t textColor)
 
void setTextSize (uint8_t size)
 
void setTextWrap (uint8_t wrap)
 
void drawChar (uint8_t x, uint8_t y, uint8_t data, uint8_t color, uint8_t size)
 
mraa::Result clear ()
 
void clearScreenBuffer ()
 
mraa::Result home ()
 
void drawPixel (int8_t x, int8_t y, uint8_t color=COLOR_WHITE)
 
void drawLine (int8_t x0, int8_t y0, int8_t x1, int8_t y1, uint8_t color=COLOR_WHITE)
 
void drawLineHorizontal (int8_t x, int8_t y, uint8_t width, uint8_t color=COLOR_WHITE)
 
void drawLineVertical (int8_t x, int8_t y, uint8_t height, uint8_t color=COLOR_WHITE)
 
void drawRectangle (int8_t x, int8_t y, uint8_t width, uint8_t height, uint8_t color=COLOR_WHITE)
 
void drawRoundedRectangle (int8_t x, int8_t y, int8_t width, int8_t height, int16_t radius, uint8_t color)
 
void drawRectangleFilled (int8_t x, int8_t y, uint8_t width, uint8_t height, uint8_t color=COLOR_WHITE)
 
void drawTriangle (int8_t x0, int8_t y0, int8_t x1, int8_t y1, int8_t x2, int8_t y2, uint8_t color=COLOR_WHITE)
 
void drawTriangleFilled (int8_t x0, int8_t y0, int8_t x1, int8_t y1, int8_t x2, int8_t y2, uint8_t color)
 
void drawCircle (int16_t x0, int16_t y0, int16_t radius, uint8_t color=COLOR_WHITE)
 
void drawRoundCorners (int8_t x0, int8_t y0, int16_t radius, uint8_t cornername, uint8_t color)
 
void drawCircleFilled (int8_t x0, int8_t y0, int16_t radius, uint8_t color)
 
void drawRoundedCornersFilled (int8_t x0, int8_t y0, int16_t radius, uint8_t cornername, int16_t delta, uint8_t color)
 
void fillScreen (uint8_t color=COLOR_WHITE)
 
- Public Member Functions inherited from LCD
mraa::Result write (int x, int y, std::string msg)
 
std::string name ()
 

Protected Member Functions

mraa::Result command (uint8_t cmd)
 
mraa::Result data (uint16_t data)
 
mraa::Result writeChar (uint8_t value)
 
mraa::Result setAddressingMode (displayAddressingMode mode)
 

Additional Inherited Members

- Protected Attributes inherited from LCD
std::string m_name
 

Constructor & Destructor Documentation

EBOLED ( int  spi = EBOLED_DEFAULT_SPI_BUS,
int  CD = EBOLED_DEFAULT_CD,
int  reset = EBOLED_DEFAULT_RESET 
)

EBOLED Constructor. Note that you will not have any choice as to the pins used, so they are all set to default values.

Parameters
spispi bus to use
CDCommand/Data select pin
resetreset pin
addressthe slave address the lcd is registered on
~EBOLED ( )

EBOLED Destructor

Here is the call graph for this function:

Member Function Documentation

mraa::Result refresh ( )

Draw the buffer to screen.

Returns
result of operation
mraa::Result write ( std::string  msg)
virtual

Write a string to LCD

Parameters
msgthe std::string to write to display, note only ascii chars are supported
Returns
result of operation

Implements LCD.

Here is the call graph for this function:

mraa::Result setCursor ( int  row,
int  column 
)
virtual

Set cursor to a coordinate

Parameters
yAxis on the vertical scale. This device supports 6 rows.
xAxis on the horizontal scale This device supports 64 columns
Returns
result of operation

Implements LCD.

Here is the caller graph for this function:

void setTextColor ( uint8_t  textColor)

Sets a text color for a message

Parameters
textColorFont color: COLOR_WHITE, COLOR_BLACK or COLOR_XOR
void setTextSize ( uint8_t  size)

Sets the size of the font

Parameters
sizeFont size
void setTextWrap ( uint8_t  wrap)

Wraps a printed message

Parameters
wrapTrue (1) or false (0)
void drawChar ( uint8_t  x,
uint8_t  y,
uint8_t  data,
uint8_t  color,
uint8_t  size 
)

Write a single character to the screen.

Parameters
xAxis on the horizontal scale
yAxis on the vertical scale
dataCharacter to write
colorCharacter color
bgCharacter background color
sizeSize of the font

Here is the call graph for this function:

Here is the caller graph for this function:

mraa::Result clear ( )
virtual

Clear display

Returns
result of operation

Implements LCD.

Here is the caller graph for this function:

mraa::Result home ( )
virtual

Return to coordinate 0,0

Returns
result of operation

Implements LCD.

Here is the call graph for this function:

void drawPixel ( int8_t  x,
int8_t  y,
uint8_t  color = COLOR_WHITE 
)

Write a single pixel to the screen buffer. Can do an specific color write or toggle (xor) a pixel.

Parameters
xthe x position of the pixel
ythe y position of the pixel
colorpixel is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the caller graph for this function:

void drawLine ( int8_t  x0,
int8_t  y0,
int8_t  x1,
int8_t  y1,
uint8_t  color = COLOR_WHITE 
)

Draw a line to the screen buffer.

Parameters
x0the x position of the beginning of the line
y0the y position of the beginning of the line
x1the x position of the end of the line
y1the y position of the end of the line
colorline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

Here is the caller graph for this function:

void drawLineHorizontal ( int8_t  x,
int8_t  y,
uint8_t  width,
uint8_t  color = COLOR_WHITE 
)

Draw a horizontal line to the screen buffer.

Parameters
xthe x position of the beginning of the line
ythe y position of the beginning of the line
widthis the horizontal length of the line
colorline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

Here is the caller graph for this function:

void drawLineVertical ( int8_t  x,
int8_t  y,
uint8_t  height,
uint8_t  color = COLOR_WHITE 
)

Draw a vertical line to the screen buffer.

Parameters
xthe x position of the beginning of the line
ythe y position of the beginning of the line
widthis the vertical length of the line
colorline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

Here is the caller graph for this function:

void drawRectangle ( int8_t  x,
int8_t  y,
uint8_t  width,
uint8_t  height,
uint8_t  color = COLOR_WHITE 
)

Draw a rectangle to the screen buffer.

Parameters
xthe left edge
ythe top edge
widthsets the right edge
heightbottom edge
coloroutline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

void drawRoundedRectangle ( int8_t  x,
int8_t  y,
int8_t  width,
int8_t  height,
int16_t  radius,
uint8_t  color 
)

Draw a rectangle with rounded corners to the screen buffer.

Parameters
xthe left edge
ythe top edge
widthsets the right edge
heightbottom edge
radiusof the rounded corners
coloroutline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

void drawRectangleFilled ( int8_t  x,
int8_t  y,
uint8_t  width,
uint8_t  height,
uint8_t  color = COLOR_WHITE 
)

Draw a filled rectangle to the screen buffer.

Parameters
xthe left edge
ythe top edge
widthsets the right edge
heightbottom edge
colorfill color is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

Here is the caller graph for this function:

void drawTriangle ( int8_t  x0,
int8_t  y0,
int8_t  x1,
int8_t  y1,
int8_t  x2,
int8_t  y2,
uint8_t  color = COLOR_WHITE 
)

Draw a triangle to the screen buffer.

Parameters
x0the x coordinate of the first corner
y0the y coordinate of the first corner
x1the x coordinate of the second corner
y1the y coordinate of the second corner
x2the x coordinate of the third corner
y2the y coordinate of the third corner
coloroutline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

void drawTriangleFilled ( int8_t  x0,
int8_t  y0,
int8_t  x1,
int8_t  y1,
int8_t  x2,
int8_t  y2,
uint8_t  color 
)

Draw a filled triangle to the screen buffer.

Parameters
x0the x coordinate of the first corner
y0the y coordinate of the first corner
x1the x coordinate of the second corner
y1the y coordinate of the second corner
x2the x coordinate of the third corner
y2the y coordinate of the third corner
colorfill color is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

void drawCircle ( int16_t  x0,
int16_t  y0,
int16_t  radius,
uint8_t  color = COLOR_WHITE 
)

Draw a circle to the screen buffer.

Parameters
x0the x coordinate of the circle's center
y0the y coordinate of the circle's center
radiusthe radius of the circle
coloroutline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

void drawRoundCorners ( int8_t  x0,
int8_t  y0,
int16_t  radius,
uint8_t  cornername,
uint8_t  color 
)

Draw a quarter circle arc to the screen buffer.

Parameters
x0the x coordinate of the arc's center
y0the y coordinate of the arc's center
radiusthe radius of the arc
cornernamedenotes which of the 4 quarters to draw - 1,2,4,8
coloroutline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

Here is the caller graph for this function:

void drawCircleFilled ( int8_t  x0,
int8_t  y0,
int16_t  radius,
uint8_t  color 
)

Draw a filled circle to the screen buffer.

Parameters
x0the x coordinate of the circle's center
y0the y coordinate of the circle's center
radiusthe radius of the circle
coloroutline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

void drawRoundedCornersFilled ( int8_t  x0,
int8_t  y0,
int16_t  radius,
uint8_t  cornername,
int16_t  delta,
uint8_t  color 
)

Draw a quarter pie to the screen buffer.

Parameters
x0the x coordinate of the arc's center
y0the y coordinate of the arc's center
radiusthe radius of the arc
cornernamedenotes which of the 4 quarters to draw - 1,2,4,8
colorfill color is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

Here is the caller graph for this function:

void fillScreen ( uint8_t  color = COLOR_WHITE)

Fill the screen buffer with specified color.

Parameters
colorfill color is COLOR_WHITE, COLOR_BLACK or COLOR_XOR

Here is the call graph for this function:

Inheritance diagram for EBOLED:
Inheritance graph
[legend]
Collaboration diagram for EBOLED:
Collaboration graph
[legend]

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