Rover API Documentation
|
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... | |
Contains the member functions to control OLED display on the Rover. This class is a wrapper API for Adafruit_GFX and Adafruit_SSD1306 libraries.
rover::RoverDisplay::RoverDisplay | ( | ) |
(Default) Constructor for RoverDisplay class
void rover::RoverDisplay::clearDisplay | ( | void | ) |
Clears the display.
void rover::RoverDisplay::display | ( | void | ) |
Displays the buffer contents on the OLED display.
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.
x | is the horizontal pixel location to start drawing bitmap |
y | is the vertical pixel location to start drawing bitmap |
w | is the width of bitmap in pixels |
h | is the height of bitmap in pixels |
color | is the color to draw the bitmap. RoverDisplay::BLACK_COLOR or RoverDisplay::WHITE_COLOR |
bitmap | is the unsigned integer array that contains the bitmap image. |
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.
x | X position of the character |
y | Y position of the character |
bitmap | Bitmap to draw |
w | Width of the bitmap |
h | Height of the bitmap |
color | Color |
void rover::RoverDisplay::drawCircle | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | r, | ||
uint16_t | color | ||
) |
Draws a circle.
x0 | Center point X position |
y0 | Center point Y position |
r | Radius of the circle |
color | Color 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.
x0 | Starting point X position |
y0 | Starting point Y position |
x1 | End point X position |
y1 | End point Y position |
color | Color of the line |
void rover::RoverDisplay::drawPixel | ( | int16_t | x, |
int16_t | y, | ||
uint16_t | color | ||
) |
Draws a pixel.
x | X position of the pixel |
y | Y position of the pixel |
color | Color 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.
x | is the horizontal pixel location to start drawing rectangle |
y | is the vertical pixel location to start drawing rectangle |
w | is the width of rectangle in pixels |
h | is the height of rectangle in pixels |
color | is the color to draw the rectangle. RoverDisplay::BLACK_COLOR or RoverDisplay::WHITE_COLOR |
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.
x | Rectangle location X |
y | Rectangle location Y |
w | Rectangle width |
h | Rectangle height |
r | Radius of the rounded corners |
color | Color 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.
x0 | First point x location |
y0 | First point y location |
x1 | Second point x location |
y1 | Second point y location |
x2 | Third point x location |
y2 | Third point y location |
color | Color of the triangle |
void rover::RoverDisplay::fillCircle | ( | int16_t | x0, |
int16_t | y0, | ||
int16_t | r, | ||
uint16_t | color | ||
) |
Draws a filled circle.
x0 | Center point X position |
y0 | Center point Y position |
r | Radius of the circle |
color | Color 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.
x | Rectangle location X |
y | Rectangle location Y |
w | Rectangle width |
h | Rectangle height |
r | Radius of the rounded corners |
color | Color of the filled rounded rectangle. |
void rover::RoverDisplay::fillScreen | ( | uint16_t | color | ) |
Fills the entire screen.
color | Color 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.
x0 | First point x location |
y0 | First point y location |
x1 | Second point x location |
y1 | Second point y location |
x2 | Third point x location |
y2 | Third point y location |
color | Color of the triangle |
Adafruit_SSD1306 & rover::RoverDisplay::getDisplay | ( | void | ) |
Returns the display object.
int16_t rover::RoverDisplay::height | ( | void | ) |
Returns width of the display.
void rover::RoverDisplay::initialize | ( | void | ) |
Initializes the OLED display of the rover.
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.
string | is the message to print to OLED display. |
void rover::RoverDisplay::setCursor | ( | int16_t | x, |
int16_t | y | ||
) |
Sets the cursor to a position in order to start typing text.
x | is the horizontal pixel location |
y | is the vertical pixel location |
void rover::RoverDisplay::setRotation | ( | uint8_t | x | ) |
Used to rotate the display. Can be 0,1,2, or 3.
x | Rotation state: 0,1,2, or 3. |
void rover::RoverDisplay::setTextColor | ( | uint16_t | c | ) |
Sets the text color to either white or black.
c | is the textcolor in integer. RoverDisplay::BLACK_COLOR or RoverDisplay::WHITE_COLOR |
void rover::RoverDisplay::setTextColor | ( | uint16_t | c, |
uint16_t | b | ||
) |
Sets the text and background color color to either white or black.
c | is the text color in integer. RoverDisplay::BLACK_COLOR or RoverDisplay::WHITE_COLOR |
b | is the background color in integer. RoverDisplay::BLACK_COLOR or RoverDisplay::WHITE_COLOR |
void rover::RoverDisplay::setTextSize | ( | uint8_t | s | ) |
Sets the text size to one of the predefined sizes.
s | is the size in unsigned integer type. Example values involve 1,2,3. |
int16_t rover::RoverDisplay::width | ( | void | ) |
Returns height of the display.
|
static |
Static definition to indicate BLACK color.
|
private |
Object to handle OLED operations.
|
private |
Flag to hold if RoverDisplay is initialized.
|
static |
Static definition to indicate WHITE color.