Rover API Documentation
rover::RoverDisplay Class Reference

Contains the member functions to control OLED display on the Rover. This class is a wrapper API for Adafruit_GFX and Adafruit_SSD1306 libraries. More...

#include <rover_display.hpp>

Public Member Functions

 RoverDisplay ()
 (Default) Constructor for RoverDisplay class More...
 
void initialize (void)
 Initializes the OLED display of the rover. More...
 
void display (void)
 Displays the buffer contents on the OLED display. More...
 
Adafruit_SSD1306 & getDisplay (void)
 Returns the display object. More...
 
void clearDisplay (void)
 Clears the display. More...
 
void drawBitmap (int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
 Draws a bitmap on the OLED display. More...
 
void setCursor (int16_t x, int16_t y)
 Sets the cursor to a position in order to start typing text. More...
 
void setTextSize (uint8_t s)
 Sets the text size to one of the predefined sizes. More...
 
void setTextColor (uint16_t c)
 Sets the text color to either white or black. More...
 
void setTextColor (uint16_t c, uint16_t b)
 Sets the text and background color color to either white or black. More...
 
void print (const char *string)
 Prints a string to OLED display starting from cursor location. More...
 
void drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 Draws a rectangle to OLED display. More...
 
void drawPixel (int16_t x, int16_t y, uint16_t color)
 Draws a pixel. More...
 
void drawCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 Draws a circle. More...
 
void fillCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 Draws a filled circle. More...
 
void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 Draws a line. More...
 
void fillScreen (uint16_t color)
 Fills the entire screen. More...
 
void fillRoundRect (int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color)
 Draws a filled rounded rectangle. More...
 
void drawRoundRect (int16_t x, int16_t y, int16_t w, int16_t h, int16_t r, uint16_t color)
 Draws a rounded rectangle. More...
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 Draws a triangle. More...
 
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 Draws a filled triangle. More...
 
void drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size)
 Used to draw a character. More...
 
void setRotation (uint8_t x)
 Used to rotate the display. Can be 0,1,2, or 3. More...
 
void invertDisplay (boolean i)
 Inverts the display. More...
 
int16_t width (void)
 Returns height of the display. More...
 
int16_t height (void)
 Returns width of the display. More...
 

Static Public Attributes

static const int BLACK_COLOR = 0
 Static definition to indicate BLACK color. More...
 
static const int WHITE_COLOR = 1
 Static definition to indicate WHITE color. More...
 

Private Attributes

Adafruit_SSD1306 my_display
 Object to handle OLED operations. More...
 
int ROVER_DISPLAY_INIT_
 Flag to hold if RoverDisplay is initialized. More...
 

Detailed Description

Contains the member functions to control OLED display on the Rover. This class is a wrapper API for Adafruit_GFX and Adafruit_SSD1306 libraries.

Constructor & Destructor Documentation

rover::RoverDisplay::RoverDisplay ( )

(Default) Constructor for RoverDisplay class

Member Function Documentation

void rover::RoverDisplay::clearDisplay ( void  )

Clears the display.

Returns
void
void rover::RoverDisplay::display ( void  )

Displays the buffer contents on the OLED display.

Returns
void
void rover::RoverDisplay::drawBitmap ( int16_t  x,
int16_t  y,
const uint8_t *  bitmap,
int16_t  w,
int16_t  h,
uint16_t  color 
)

Draws a bitmap on the OLED display.

Parameters
xis the horizontal pixel location to start drawing bitmap
yis the vertical pixel location to start drawing bitmap
wis the width of bitmap in pixels
his the height of bitmap in pixels
coloris the color to draw the bitmap. RoverDisplay::BLACK_COLOR or RoverDisplay::WHITE_COLOR
bitmapis the unsigned integer array that contains the bitmap image.
Returns
void
void rover::RoverDisplay::drawChar ( int16_t  x,
int16_t  y,
unsigned char  c,
uint16_t  color,
uint16_t  bg,
uint8_t  size 
)

Used to draw a character.

Parameters
xX position of the character
yY position of the character
bitmapBitmap to draw
wWidth of the bitmap
hHeight of the bitmap
colorColor
void rover::RoverDisplay::drawCircle ( int16_t  x0,
int16_t  y0,
int16_t  r,
uint16_t  color 
)

Draws a circle.

Parameters
x0Center point X position
y0Center point Y position
rRadius of the circle
colorColor of the circule
void rover::RoverDisplay::drawLine ( int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
uint16_t  color 
)

Draws a line.

Parameters
x0Starting point X position
y0Starting point Y position
x1End point X position
y1End point Y position
colorColor of the line
void rover::RoverDisplay::drawPixel ( int16_t  x,
int16_t  y,
uint16_t  color 
)

Draws a pixel.

Parameters
xX position of the pixel
yY position of the pixel
colorColor of the pixel
void rover::RoverDisplay::drawRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
uint16_t  color 
)

Draws a rectangle to OLED display.

Parameters
xis the horizontal pixel location to start drawing rectangle
yis the vertical pixel location to start drawing rectangle
wis the width of rectangle in pixels
his the height of rectangle in pixels
coloris the color to draw the rectangle. RoverDisplay::BLACK_COLOR or RoverDisplay::WHITE_COLOR
Returns
void
void rover::RoverDisplay::drawRoundRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
int16_t  r,
uint16_t  color 
)

Draws a rounded rectangle.

Parameters
xRectangle location X
yRectangle location Y
wRectangle width
hRectangle height
rRadius of the rounded corners
colorColor of the rounded rectangle.
void rover::RoverDisplay::drawTriangle ( int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2,
uint16_t  color 
)

Draws a triangle.

Parameters
x0First point x location
y0First point y location
x1Second point x location
y1Second point y location
x2Third point x location
y2Third point y location
colorColor of the triangle
void rover::RoverDisplay::fillCircle ( int16_t  x0,
int16_t  y0,
int16_t  r,
uint16_t  color 
)

Draws a filled circle.

Parameters
x0Center point X position
y0Center point Y position
rRadius of the circle
colorColor of the circule
void rover::RoverDisplay::fillRoundRect ( int16_t  x,
int16_t  y,
int16_t  w,
int16_t  h,
int16_t  r,
uint16_t  color 
)

Draws a filled rounded rectangle.

Parameters
xRectangle location X
yRectangle location Y
wRectangle width
hRectangle height
rRadius of the rounded corners
colorColor of the filled rounded rectangle.
void rover::RoverDisplay::fillScreen ( uint16_t  color)

Fills the entire screen.

Parameters
colorColor to fill the screen with
void rover::RoverDisplay::fillTriangle ( int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2,
uint16_t  color 
)

Draws a filled triangle.

Parameters
x0First point x location
y0First point y location
x1Second point x location
y1Second point y location
x2Third point x location
y2Third point y location
colorColor of the triangle
Adafruit_SSD1306 & rover::RoverDisplay::getDisplay ( void  )

Returns the display object.

Returns
void
int16_t rover::RoverDisplay::height ( void  )

Returns width of the display.

void rover::RoverDisplay::initialize ( void  )

Initializes the OLED display of the rover.

Returns
void
void rover::RoverDisplay::invertDisplay ( boolean  i)

Inverts the display.

void rover::RoverDisplay::print ( const char *  string)

Prints a string to OLED display starting from cursor location.

Parameters
stringis the message to print to OLED display.
Returns
void
void rover::RoverDisplay::setCursor ( int16_t  x,
int16_t  y 
)

Sets the cursor to a position in order to start typing text.

Parameters
xis the horizontal pixel location
yis the vertical pixel location
Returns
void
void rover::RoverDisplay::setRotation ( uint8_t  x)

Used to rotate the display. Can be 0,1,2, or 3.

Parameters
xRotation state: 0,1,2, or 3.
void rover::RoverDisplay::setTextColor ( uint16_t  c)

Sets the text color to either white or black.

Parameters
cis the textcolor in integer. RoverDisplay::BLACK_COLOR or RoverDisplay::WHITE_COLOR
Returns
void
void rover::RoverDisplay::setTextColor ( uint16_t  c,
uint16_t  b 
)

Sets the text and background color color to either white or black.

Parameters
cis the text color in integer. RoverDisplay::BLACK_COLOR or RoverDisplay::WHITE_COLOR
bis the background color in integer. RoverDisplay::BLACK_COLOR or RoverDisplay::WHITE_COLOR
Returns
void
void rover::RoverDisplay::setTextSize ( uint8_t  s)

Sets the text size to one of the predefined sizes.

Parameters
sis the size in unsigned integer type. Example values involve 1,2,3.
Returns
void
int16_t rover::RoverDisplay::width ( void  )

Returns height of the display.

Member Data Documentation

const int rover::RoverDisplay::BLACK_COLOR = 0
static

Static definition to indicate BLACK color.

Adafruit_SSD1306 rover::RoverDisplay::my_display
private

Object to handle OLED operations.

int rover::RoverDisplay::ROVER_DISPLAY_INIT_
private

Flag to hold if RoverDisplay is initialized.

const int rover::RoverDisplay::WHITE_COLOR = 1
static

Static definition to indicate WHITE color.


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