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

API for SSD1306 I2C-controlled OLED displays. More...

Detailed Description

SSD1306 is a 128x64 dot-matrix OLED/PLED segment driver with a controller. This device is available from many suppliers for a very low cost. This implementation was tested using a generic SSD1306 device from eBay.

ssd1306.jpeg
upm::SSD1306 lcd(BUS_NUMBER, DEVICE_ADDRESS);
lcd.clear();
lcd.stopscroll();
lcd.draw(intel_logo, 1024);
upm_delay(3);
lcd.clear();
lcd.setCursor(2, 0);
lcd.write("Hello");
lcd.setCursor(3, 0);
lcd.write("World");
upm_delay(3);
lcd.invert(true);
upm_delay(3);
lcd.dim(true);
upm_delay(3);
lcd.dim(false);
upm_delay(3);
lcd.invert(false);
lcd.startscrollright(0x00, 0x0F);
upm_delay(5);
lcd.stopscroll();
lcd.startscrollleft(0x00, 0x0F);
upm_delay(5);
lcd.stopscroll();
lcd.startscrolldiagleft(0x00, 0x0F);
upm_delay(5);
lcd.stopscroll();
lcd.startscrolldiagright(0x00, 0x0F);
upm_delay(5);
lcd.stopscroll();

Public Member Functions

 SSD1306 (int bus, int address=0x3C)
 
 ~SSD1306 ()
 
mraa::Result draw (uint8_t *data, int bytes)
 
mraa::Result write (std::string msg)
 
mraa::Result setCursor (int row, int column)
 
mraa::Result clear ()
 
mraa::Result home ()
 
mraa::Result invert (bool i)
 
void startscrollright (uint8_t start, uint8_t stop)
 
void startscrollleft (uint8_t start, uint8_t stop)
 
void startscrolldiagright (uint8_t start, uint8_t stop)
 
void startscrolldiagleft (uint8_t start, uint8_t stop)
 
void stopscroll (void)
 
void dim (bool dim)
 
- Public Member Functions inherited from LCD
mraa::Result write (int x, int y, std::string msg)
 
std::string name ()
 

Additional Inherited Members

- Protected Attributes inherited from LCD
std::string m_name
 

Constructor & Destructor Documentation

SSD1306 ( int  bus,
int  address = 0x3C 
)

SSD1306 constructor; calls libmraa initialisation functions

Parameters
busI2C bus to use
addressSlave address the LCD is registered on

Here is the call graph for this function:

~SSD1306 ( )

SSD1306 destructor

Member Function Documentation

mraa::Result draw ( uint8_t *  data,
int  bytes 
)

Draws an image; see examples/python/make_oled_pic.py for an explanation of how pixels are mapped to bytes

Parameters
dataBuffer to read
bytesNumber of bytes to read from the pointer
Returns
Result of the operation
mraa::Result write ( std::string  msg)
virtual

Writes a string to the LCD

Parameters
msgstd::string to write to the display; note: only ASCII characters are supported
Returns
Result of the operation

Implements LCD.

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

Sets the cursor to specified coordinates

Parameters
rowRow to set the cursor to
columnColumn to set the cursor to
Returns
Result of the operation

Implements LCD.

Here is the caller graph for this function:

mraa::Result clear ( )
virtual

Clears the display of all characters

Returns
Result of the operation

Implements LCD.

Here is the call graph for this function:

Here is the caller graph for this function:

mraa::Result home ( )
virtual

Returns to the original coordinates (0,0)

Returns
Result of the operation

Implements LCD.

Here is the call graph for this function:

Here is the caller graph for this function:

mraa::Result invert ( bool  i)

Inverts the display

Parameters
itrue to invert, false for normal display
Returns
Result of the operation
void startscrollright ( uint8_t  start,
uint8_t  stop 
)

Activate a scroll to the right for rows start through stop The display is 16 rows tall. To scroll the whole display, run: display.scrollright(0x00, 0x0F)

Parameters
startFirst row to scroll
stopLast row to scroll
Returns
void
void startscrollleft ( uint8_t  start,
uint8_t  stop 
)

Activate a scroll to the left for rows start through stop The display is 16 rows tall. To scroll the whole display, run: display.startscrollright(0x00, 0x0F)

Parameters
startFirst row to scroll
stopLast row to scroll
Returns
void
void startscrolldiagright ( uint8_t  start,
uint8_t  stop 
)

Activate a scroll to the upper right for rows start through stop The display is 16 rows tall. To scroll the whole display, run: display.startscrollleft(0x00, 0x0F)

Parameters
startFirst row to scroll
stopLast row to scroll
Returns
void
void startscrolldiagleft ( uint8_t  start,
uint8_t  stop 
)

Activate a scroll to the upper left for rows start through stop The display is 16 rows tall. To scroll the whole display, run: display.startscrolldiaagright(0x00, 0x0F)

Parameters
startFirst row to scroll
stopLast row to scroll
Returns
void
void stopscroll ( void  )

Stops display scrolling.

Returns
void
void dim ( bool  dim)

Dims display

Parameters
dimTrue to dim display, false for max intensity
Returns
Result of last operation
Inheritance diagram for SSD1306:
Inheritance graph
[legend]
Collaboration diagram for SSD1306:
Collaboration graph
[legend]

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