upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions

API for SSD1351 OLED displays. More...

Detailed Description

This module defines the interface for the SSD1351 display library. It was tested with the Adafruit 1.5" OLED Display, but should work with any SSD1351 display running in SPI mode.

On the Intel Edison don't forget to disable SPI Power Management (PM) for this driver to work, you can find more details on this topic here: http://iotdk.intel.com/docs/master/mraa/edison.html

ssd1351.jpg
// Initialize display with pins
// oc = 0, dc = 1, r = 2, si = 11, cl = 13
upm::SSD1351 display(0, 1, 2);
// Test lines pixel by pixel
for (int i = 0; i < SSD1351HEIGHT; i++) {
for (int j = 0; j < SSD1351WIDTH; j++) {
display.drawPixel(i, j, colors[i / 8]);
}
}
display.refresh();
upm_delay(5);
// Test rectangles
for (int i = 0; i < SSD1351HEIGHT / 32; i++) {
for (int j = 0; j < SSD1351WIDTH / 32; j++) {
display.fillRect(i * 32, j * 32, 32, 32, colors[i * 4 + j]);
}
}
display.refresh();
upm_delay(5);
// Test circles
display.fillScreen(0x2104);
for (int i = 0; i < SSD1351HEIGHT / 32; i++) {
for (int j = 0; j < SSD1351WIDTH / 32; j++) {
display.drawCircle(i * 32 + 15, j * 32 + 15, 15, colors[i * 4 + j]);
}
}
display.refresh();
upm_delay(5);
// Test Text
display.fillScreen(INTEL_BLUE);
display.setTextColor(WHITE, INTEL_BLUE);
display.setTextSize(4);
display.setCursor(7, 30);
display.print("Intel");
display.setCursor(5, 70);
display.print("IoTDK");
display.refresh();

Public Member Functions

 SSD1351 (int oc, int dc, int rst)
 
 ~SSD1351 ()
 
std::string name ()
 
void writeCommand (uint8_t value)
 
void writeData (uint8_t value)
 
void drawPixel (int16_t x, int16_t y, uint16_t color)
 
void refresh ()
 
void ocLow ()
 
void ocHigh ()
 
void dcLow ()
 
void dcHigh ()
 
void useMemoryMap (bool var)
 
- Public Member Functions inherited from GFX
 GFX (int16_t w, int16_t h)
 
virtual ~GFX ()
 
virtual void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 
virtual void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 
virtual void drawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color)
 
virtual void drawRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
virtual void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
virtual void fillScreen (uint16_t color)
 
virtual void invertDisplay (bool i)
 
void drawCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 
void drawCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, uint16_t color)
 
void fillCircle (int16_t x0, int16_t y0, int16_t r, uint16_t color)
 
void fillCircleHelper (int16_t x0, int16_t y0, int16_t r, uint8_t cornername, int16_t delta, uint16_t color)
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void fillTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void drawRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 
void fillRoundRect (int16_t x0, int16_t y0, int16_t w, int16_t h, int16_t radius, uint16_t color)
 
void drawChar (int16_t x, int16_t y, unsigned char c, uint16_t color, uint16_t bg, uint8_t size)
 
int16_t getCursorX (void) const
 
int16_t getCursorY (void) const
 
void setCursor (int16_t x, int16_t y)
 
void setTextColor (uint16_t c)
 
void setTextColor (uint16_t c, uint16_t bg)
 
void setTextSize (uint8_t s)
 
void setTextWrap (bool w)
 
uint8_t getRotation (void) const
 
void setRotation (uint8_t r)
 
void cp437 (bool x)
 
virtual void write (uint8_t c)
 
void print (std::string msg)
 
int16_t width (void) const
 
int16_t height (void) const
 
 GFX (int width, int height)
 
virtual ~GFX ()
 
void drawChar (int16_t x, int16_t y, uint8_t data, uint16_t color, uint16_t bg, uint8_t size)
 
void print (std::string msg)
 
void fillScreen (uint16_t color)
 
void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 
void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void drawCircle (int16_t x, int16_t y, int16_t r, uint16_t color)
 
void setCursor (int16_t x, int16_t y)
 
void setTextColor (uint16_t textColor, uint16_t textBGColor)
 
void setTextSize (uint8_t size)
 
void setTextWrap (uint8_t wrap)
 
 GFX (int width, int height, uint8_t *screenBuffer, const unsigned char *font)
 
virtual ~GFX ()
 
virtual void setAddrWindow (uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)=0
 
void drawChar (int16_t x, int16_t y, uint8_t data, uint16_t color, uint16_t bg, uint8_t size)
 
void print (std::string msg)
 
mraa::Result setPixel (int x, int y, uint16_t color)
 
void fillScreen (uint16_t color)
 
void fillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
 
void drawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color)
 
void drawLine (int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
 
void drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color)
 
void drawCircle (int16_t x, int16_t y, int16_t r, uint16_t color)
 
void setCursor (int16_t x, int16_t y)
 
void setTextColor (uint16_t textColor, uint16_t textBGColor)
 
void setTextSize (uint8_t size)
 
void setTextWrap (uint8_t wrap)
 

Additional Inherited Members

- Data Fields inherited from GFX
uint8_t * m_map
 
- Protected Attributes inherited from GFX
const int16_t WIDTH
 
const int16_t HEIGHT
 
int16_t _width
 
int16_t _height
 
uint8_t rotation
 
uint16_t textcolor
 
uint16_t textbgcolor
 
int16_t cursor_x
 
int16_t cursor_y
 
uint8_t textsize
 
bool wrap
 
bool _cp437
 
int m_width
 
int m_height
 
int m_textSize
 
int m_textColor
 
int m_textBGColor
 
int m_cursorX
 
int m_cursorY
 
int m_wrap
 
const unsigned char * m_font
 
- Static Protected Attributes inherited from GFX
static const unsigned char font []
 

Constructor & Destructor Documentation

SSD1351 ( int  oc,
int  dc,
int  rst 
)

Instantiates an SSD1351 object

Parameters
ocLCD chip select pin
dcData/command pin
rstReset pin

Here is the call graph for this function:

~SSD1351 ( )

SSD1351 object destructor

Member Function Documentation

std::string name ( )
inline

Returns the name of the component

Here is the call graph for this function:

void writeCommand ( uint8_t  value)

Sends a command to an SPI bus

Parameters
valueCommand

Here is the call graph for this function:

Here is the caller graph for this function:

void writeData ( uint8_t  value)

Sends data to an SPI bus

Parameters
valueData

Here is the call graph for this function:

Here is the caller graph for this function:

void drawPixel ( int16_t  x,
int16_t  y,
uint16_t  color 
)
virtual

Sends a pixel color (RGB) to the display buffer or chip

Parameters
xAxis on the horizontal scale
yAxis on the vertical scale
colorRGB (16-bit) color (R[0-4], G[5-10], B[11-15])

Implements GFX.

Here is the call graph for this function:

Here is the caller graph for this function:

void refresh ( )
virtual

Copies the buffer to the chip via the SPI bus

Implements GFX.

Here is the call graph for this function:

Here is the caller graph for this function:

void ocLow ( )

Set OLED chip select LOW

Here is the caller graph for this function:

void ocHigh ( )

Set OLED chip select HIGH

Here is the caller graph for this function:

void dcLow ( )

Data select LOW

Here is the caller graph for this function:

void dcHigh ( )

Data select HIGH

Here is the caller graph for this function:

void useMemoryMap ( bool  var)

Use memory mapped (buffered) writes to the display

Parameters
vartrue for yes (default), false for no

Here is the caller graph for this function:

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

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