# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_pyupm_lcd', [dirname(__file__)])
except ImportError:
import _pyupm_lcd
return _pyupm_lcd
if fp is not None:
try:
_mod = imp.load_module('_pyupm_lcd', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_lcd = swig_import_helper()
del swig_import_helper
else:
import _pyupm_lcd
del version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
if _newclass:
object.__setattr__(self, name, value)
else:
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
if (not static):
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except AttributeError:
class _object:
pass
_newclass = 0
def getVersion():
return _pyupm_lcd.getVersion()
getVersion = _pyupm_lcd.getVersion
[docs]class uint8Array(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, uint8Array, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, uint8Array, name)
__repr__ = _swig_repr
def __init__(self, nelements):
this = _pyupm_lcd.new_uint8Array(nelements)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_lcd.delete_uint8Array
__del__ = lambda self: None
def __getitem__(self, index):
return _pyupm_lcd.uint8Array___getitem__(self, index)
def __setitem__(self, index, value):
return _pyupm_lcd.uint8Array___setitem__(self, index, value)
[docs] def cast(self):
return _pyupm_lcd.uint8Array_cast(self)
__swig_getmethods__["frompointer"] = lambda x: _pyupm_lcd.uint8Array_frompointer
if _newclass:
frompointer = staticmethod(_pyupm_lcd.uint8Array_frompointer)
uint8Array_swigregister = _pyupm_lcd.uint8Array_swigregister
uint8Array_swigregister(uint8Array)
def uint8Array_frompointer(t):
return _pyupm_lcd.uint8Array_frompointer(t)
uint8Array_frompointer = _pyupm_lcd.uint8Array_frompointer
[docs]class LCD(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, LCD, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, LCD, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _pyupm_lcd.delete_LCD
__del__ = lambda self: None
[docs] def write(self, *args):
"""
virtual mraa::Result
write(std::string msg)=0
"""
return _pyupm_lcd.LCD_write(self, *args)
[docs] def setCursor(self, row, column):
"""
virtual mraa::Result
setCursor(int row, int column)=0
"""
return _pyupm_lcd.LCD_setCursor(self, row, column)
[docs] def clear(self):
"""
virtual mraa::Result
clear()=0
"""
return _pyupm_lcd.LCD_clear(self)
[docs] def home(self):
"""
virtual mraa::Result home()=0
"""
return _pyupm_lcd.LCD_home(self)
[docs] def name(self):
"""std::string name() """
return _pyupm_lcd.LCD_name(self)
LCD_swigregister = _pyupm_lcd.LCD_swigregister
LCD_swigregister(LCD)
_pyupm_lcd.EBOLED_DEFAULT_SPI_BUS_swigconstant(_pyupm_lcd)
EBOLED_DEFAULT_SPI_BUS = _pyupm_lcd.EBOLED_DEFAULT_SPI_BUS
_pyupm_lcd.EBOLED_DEFAULT_CD_swigconstant(_pyupm_lcd)
EBOLED_DEFAULT_CD = _pyupm_lcd.EBOLED_DEFAULT_CD
_pyupm_lcd.EBOLED_DEFAULT_RESET_swigconstant(_pyupm_lcd)
EBOLED_DEFAULT_RESET = _pyupm_lcd.EBOLED_DEFAULT_RESET
[docs]class EBOLED(LCD):
"""
API for EBOLED spi controlled OLED display.
ID: eboled
Name: SparkFun Block for Intel Edison - OLED
Other Names: ssd1306
Category: display
Manufacturer: sparkfun
Link:https://www.sparkfun.com/products/13035
Connection: spi 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.
OLED Sensor image provided by SparkFun* underCC BY-NC-SA-3.0.
C++ includes: eboled.hpp
"""
__swig_setmethods__ = {}
for _s in [LCD]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, EBOLED, name, value)
__swig_getmethods__ = {}
for _s in [LCD]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, EBOLED, name)
__repr__ = _swig_repr
def __init__(self, spi=0, CD=36, reset=48):
"""
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:
-----------
spi: spi bus to use
CD: Command/Data select pin
reset: reset pin
"""
this = _pyupm_lcd.new_EBOLED(spi, CD, reset)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_lcd.delete_EBOLED
__del__ = lambda self: None
[docs] def refresh(self):
"""
mraa::Result refresh()
Draw the buffer to screen.
result of operation
"""
return _pyupm_lcd.EBOLED_refresh(self)
[docs] def write(self, msg):
"""
mraa::Result
write(std::string msg)
Write a string to LCD
Parameters:
-----------
msg: the std::string to write to display, note only ascii chars are
supported
result of operation
"""
return _pyupm_lcd.EBOLED_write(self, msg)
[docs] def setCursor(self, row, column):
"""
mraa::Result
setCursor(int row, int column)
Set cursor to a coordinate
Parameters:
-----------
row: Axis on the vertical scale. This device supports 6 rows.
column: Axis on the horizontal scale This device supports 64 columns
result of operation
"""
return _pyupm_lcd.EBOLED_setCursor(self, row, column)
[docs] def setTextColor(self, textColor):
"""
void
setTextColor(uint8_t textColor)
Sets a text color for a message
Parameters:
-----------
textColor: Font color: COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_setTextColor(self, textColor)
[docs] def setTextSize(self, size):
"""
void
setTextSize(uint8_t size)
Sets the size of the font
Parameters:
-----------
size: Font size
"""
return _pyupm_lcd.EBOLED_setTextSize(self, size)
[docs] def setTextWrap(self, wrap):
"""
void
setTextWrap(uint8_t wrap)
Wraps a printed message
Parameters:
-----------
wrap: True (1) or false (0)
"""
return _pyupm_lcd.EBOLED_setTextWrap(self, wrap)
[docs] def drawChar(self, x, y, data, color, size):
"""
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:
-----------
x: Axis on the horizontal scale
y: Axis on the vertical scale
data: Character to write
color: Character color
size: Size of the font
"""
return _pyupm_lcd.EBOLED_drawChar(self, x, y, data, color, size)
[docs] def clear(self):
"""
mraa::Result clear()
Clear display
result of operation
"""
return _pyupm_lcd.EBOLED_clear(self)
[docs] def clearScreenBuffer(self):
"""
void
clearScreenBuffer()
"""
return _pyupm_lcd.EBOLED_clearScreenBuffer(self)
[docs] def home(self):
"""
mraa::Result home()
Return to coordinate 0,0
result of operation
"""
return _pyupm_lcd.EBOLED_home(self)
[docs] def drawPixel(self, *args):
"""
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:
-----------
x: the x position of the pixel
y: the y position of the pixel
color: pixel is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawPixel(self, *args)
[docs] def drawLine(self, *args):
"""
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:
-----------
x0: the x position of the beginning of the line
y0: the y position of the beginning of the line
x1: the x position of the end of the line
y1: the y position of the end of the line
color: line is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawLine(self, *args)
[docs] def drawLineHorizontal(self, *args):
"""
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:
-----------
x: the x position of the beginning of the line
y: the y position of the beginning of the line
width: is the horizontal length of the line
color: line is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawLineHorizontal(self, *args)
[docs] def drawLineVertical(self, *args):
"""
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:
-----------
x: the x position of the beginning of the line
y: the y position of the beginning of the line
height: is the vertical length of the line
color: line is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawLineVertical(self, *args)
[docs] def drawRectangle(self, *args):
"""
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:
-----------
x: the left edge
y: the top edge
width: sets the right edge
height: bottom edge
color: outline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawRectangle(self, *args)
[docs] def drawRoundedRectangle(self, x, y, width, height, radius, color):
"""
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:
-----------
x: the left edge
y: the top edge
width: sets the right edge
height: bottom edge
radius: of the rounded corners
color: outline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawRoundedRectangle(self, x, y, width, height, radius, color)
[docs] def drawRectangleFilled(self, *args):
"""
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:
-----------
x: the left edge
y: the top edge
width: sets the right edge
height: bottom edge
color: fill color is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawRectangleFilled(self, *args)
[docs] def drawTriangle(self, *args):
"""
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:
-----------
x0: the x coordinate of the first corner
y0: the y coordinate of the first corner
x1: the x coordinate of the second corner
y1: the y coordinate of the second corner
x2: the x coordinate of the third corner
y2: the y coordinate of the third corner
color: outline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawTriangle(self, *args)
[docs] def drawTriangleFilled(self, x0, y0, x1, y1, x2, y2, color):
"""
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:
-----------
x0: the x coordinate of the first corner
y0: the y coordinate of the first corner
x1: the x coordinate of the second corner
y1: the y coordinate of the second corner
x2: the x coordinate of the third corner
y2: the y coordinate of the third corner
color: fill color is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawTriangleFilled(self, x0, y0, x1, y1, x2, y2, color)
[docs] def drawCircle(self, *args):
"""
void
drawCircle(int16_t x0, int16_t y0, int16_t radius, uint8_t
color=COLOR_WHITE)
Draw a circle to the screen buffer.
Parameters:
-----------
x0: the x coordinate of the circle's center
y0: the y coordinate of the circle's center
radius: the radius of the circle
color: outline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawCircle(self, *args)
[docs] def drawRoundCorners(self, x0, y0, radius, cornername, color):
"""
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:
-----------
x0: the x coordinate of the arc's center
y0: the y coordinate of the arc's center
radius: the radius of the arc
cornername: denotes which of the 4 quarters to draw - 1,2,4,8
color: outline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawRoundCorners(self, x0, y0, radius, cornername, color)
[docs] def drawCircleFilled(self, x0, y0, radius, color):
"""
void
drawCircleFilled(int8_t x0, int8_t y0, int16_t radius, uint8_t color)
Draw a filled circle to the screen buffer.
Parameters:
-----------
x0: the x coordinate of the circle's center
y0: the y coordinate of the circle's center
radius: the radius of the circle
color: outline is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawCircleFilled(self, x0, y0, radius, color)
[docs] def drawRoundedCornersFilled(self, x0, y0, radius, cornername, delta, color):
"""
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:
-----------
x0: the x coordinate of the arc's center
y0: the y coordinate of the arc's center
radius: the radius of the arc
cornername: denotes which of the 4 quarters to draw - 1,2,4,8
color: fill color is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_drawRoundedCornersFilled(self, x0, y0, radius, cornername, delta, color)
[docs] def fillScreen(self, *args):
"""
void
fillScreen(uint8_t color=COLOR_WHITE)
Fill the screen buffer with specified color.
Parameters:
-----------
color: fill color is COLOR_WHITE, COLOR_BLACK or COLOR_XOR
"""
return _pyupm_lcd.EBOLED_fillScreen(self, *args)
EBOLED_swigregister = _pyupm_lcd.EBOLED_swigregister
EBOLED_swigregister(EBOLED)
cvar = _pyupm_lcd.cvar
COLOR_WHITE = cvar.COLOR_WHITE
COLOR_BLACK = cvar.COLOR_BLACK
COLOR_XOR = cvar.COLOR_XOR
OLED_WIDTH = cvar.OLED_WIDTH
VERT_COLUMNS = cvar.VERT_COLUMNS
OLED_HEIGHT = cvar.OLED_HEIGHT
BUFFER_SIZE = cvar.BUFFER_SIZE
[docs]class SSD1306(LCD):
"""
API for SSD1306 I2C-controlled OLED displays.
ID: ssd1306
Name: OLED Display
Other Names: Adafruit SSD1306 OLED Display 0.96"
Category: display
Manufacturer: adafruit
Link:https://www.adafruit.com/datasheets/SSD1306.pdf
Link:http://www.farnell.com/datasheets/609753.pdf
Connection: i2c 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.
C++ includes: ssd1306.hpp
"""
__swig_setmethods__ = {}
for _s in [LCD]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, SSD1306, name, value)
__swig_getmethods__ = {}
for _s in [LCD]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, SSD1306, name)
__repr__ = _swig_repr
def __init__(self, bus, address=0x3C):
"""
SSD1306(int bus, int
address=0x3C)
SSD1306 constructor; calls libmraa initialisation functions
Parameters:
-----------
bus: I2C bus to use
address: Slave address the LCD is registered on
"""
this = _pyupm_lcd.new_SSD1306(bus, address)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_lcd.delete_SSD1306
__del__ = lambda self: None
[docs] def draw(self, data, bytes):
"""
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:
-----------
data: Buffer to read
bytes: Number of bytes to read from the pointer
Result of the operation
"""
return _pyupm_lcd.SSD1306_draw(self, data, bytes)
[docs] def write(self, msg):
"""
mraa::Result
write(std::string msg)
Writes a string to the LCD
Parameters:
-----------
msg: std::string to write to the display; note: only ASCII characters
are supported
Result of the operation
"""
return _pyupm_lcd.SSD1306_write(self, msg)
[docs] def setCursor(self, row, column):
"""
mraa::Result
setCursor(int row, int column)
Sets the cursor to specified coordinates
Parameters:
-----------
row: Row to set the cursor to
column: Column to set the cursor to
Result of the operation
"""
return _pyupm_lcd.SSD1306_setCursor(self, row, column)
[docs] def clear(self):
"""
mraa::Result clear()
Clears the display of all characters
Result of the operation
"""
return _pyupm_lcd.SSD1306_clear(self)
[docs] def home(self):
"""
mraa::Result home()
Returns to the original coordinates (0,0)
Result of the operation
"""
return _pyupm_lcd.SSD1306_home(self)
[docs] def invert(self, i):
"""
mraa::Result invert(bool
i)
Inverts the display
Parameters:
-----------
i: true to invert, false for normal display
Result of the operation
"""
return _pyupm_lcd.SSD1306_invert(self, i)
[docs] def dim(self, dim):
"""
void dim(bool dim)
Dims display
Parameters:
-----------
dim: True to dim display, false for max intensity
Result of last operation
"""
return _pyupm_lcd.SSD1306_dim(self, dim)
SSD1306_swigregister = _pyupm_lcd.SSD1306_swigregister
SSD1306_swigregister(SSD1306)
DISPLAY_CMD_SET_NORMAL_1306 = cvar.DISPLAY_CMD_SET_NORMAL_1306
SSD1306_SETCONTRAST = cvar.SSD1306_SETCONTRAST
SSD1306_DISPLAYALLON_RESUME = cvar.SSD1306_DISPLAYALLON_RESUME
SSD1306_DISPLAYALLON = cvar.SSD1306_DISPLAYALLON
DISPLAY_CMD_SET_INVERT_1306 = cvar.DISPLAY_CMD_SET_INVERT_1306
SSD1306_SETDISPLAYOFFSET = cvar.SSD1306_SETDISPLAYOFFSET
SSD1306_SETCOMPINS = cvar.SSD1306_SETCOMPINS
SSD1306_SETVCOMDETECT = cvar.SSD1306_SETVCOMDETECT
SSD1306_SETDISPLAYCLOCKDIV = cvar.SSD1306_SETDISPLAYCLOCKDIV
SSD1306_SETPRECHARGE = cvar.SSD1306_SETPRECHARGE
SSD1306_SETMULTIPLEX = cvar.SSD1306_SETMULTIPLEX
SSD1306_SETLOWCOLUM = cvar.SSD1306_SETLOWCOLUM
SSD1306_SETHIGHCOLUMN = cvar.SSD1306_SETHIGHCOLUMN
SSD1306_SETSTARTLINE = cvar.SSD1306_SETSTARTLINE
SSD1306_MEMORYMODE = cvar.SSD1306_MEMORYMODE
SSD1306_COLUMNADDR = cvar.SSD1306_COLUMNADDR
SSD1306_PAGEADDR = cvar.SSD1306_PAGEADDR
SSD1306_COMSCANINC = cvar.SSD1306_COMSCANINC
SSD1306_COMSCANDEC = cvar.SSD1306_COMSCANDEC
SSD1306_SEGREMAP = cvar.SSD1306_SEGREMAP
SSD1306_CHARGEPUMP = cvar.SSD1306_CHARGEPUMP
SSD1306_EXTERNALVCC = cvar.SSD1306_EXTERNALVCC
SSD1306_SWITCHCAPVCC = cvar.SSD1306_SWITCHCAPVCC
SSD1306_ACTIVATE_SCROLL = cvar.SSD1306_ACTIVATE_SCROLL
SSD1306_DEACTIVATE_SCROLL = cvar.SSD1306_DEACTIVATE_SCROLL
SSD1306_SET_VERTICAL_SCROLL_AREA = cvar.SSD1306_SET_VERTICAL_SCROLL_AREA
SSD1306_RIGHT_HORIZONTAL_SCROLL = cvar.SSD1306_RIGHT_HORIZONTAL_SCROLL
SSD1306_LEFT_HORIZONTAL_SCROLL = cvar.SSD1306_LEFT_HORIZONTAL_SCROLL
SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL = cvar.SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL
SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL = cvar.SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL
SSD1306_BLACK = cvar.SSD1306_BLACK
SSD1306_WHITE = cvar.SSD1306_WHITE
SSD1306_LCDWIDTH = cvar.SSD1306_LCDWIDTH
SSD1306_LCDHEIGHT = cvar.SSD1306_LCDHEIGHT
[docs]class SSD1308(LCD):
"""
API for SSD1308 I2C-controlled OLED displays.
ID: ssd1308
Name: OLED Display
Other Names: Grove OLED Display 0.96"
Category: display
Manufacturer: seeed adafruit
Link:http://wiki.seeed.cc/Grove-OLED_Display_0.96inch/
Link:http://www.seeedstudio.com/wiki/Grove_-_OLED_Display_0.96%22
Connection: i2c SSD1308 is a 128x64 dot-matrix OLED/PLED segment
driver with a controller. This implementation was tested using the
Grove LED 128*64 Display module, which is an OLED monochrome display.
C++ includes: ssd1308.hpp
"""
__swig_setmethods__ = {}
for _s in [LCD]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, SSD1308, name, value)
__swig_getmethods__ = {}
for _s in [LCD]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, SSD1308, name)
__repr__ = _swig_repr
def __init__(self, bus, address=0x3C):
"""
SSD1308(int bus, int
address=0x3C)
SSD1308 constructor; calls libmraa initialisation functions
Parameters:
-----------
bus: I2C bus to use
address: Slave address the LCD is registered on
"""
this = _pyupm_lcd.new_SSD1308(bus, address)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_lcd.delete_SSD1308
__del__ = lambda self: None
[docs] def draw(self, data, bytes):
"""
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:
-----------
data: Buffer to read
bytes: Number of bytes to read from the pointer
Result of the operation
"""
return _pyupm_lcd.SSD1308_draw(self, data, bytes)
[docs] def write(self, msg):
"""
mraa::Result
write(std::string msg)
Writes a string to the LCD
Parameters:
-----------
msg: std::string to write to the display; note: only ASCII characters
are supported
Result of the operation
"""
return _pyupm_lcd.SSD1308_write(self, msg)
[docs] def setCursor(self, row, column):
"""
mraa::Result
setCursor(int row, int column)
Sets the cursor to specified coordinates
Parameters:
-----------
row: Row to set the cursor to
column: Column to set the cursor to
Result of the operation
"""
return _pyupm_lcd.SSD1308_setCursor(self, row, column)
[docs] def clear(self):
"""
mraa::Result clear()
Clears the display of all characters
Result of the operation
"""
return _pyupm_lcd.SSD1308_clear(self)
[docs] def home(self):
"""
mraa::Result home()
Returns to the original coordinates (0,0)
Result of the operation
"""
return _pyupm_lcd.SSD1308_home(self)
SSD1308_swigregister = _pyupm_lcd.SSD1308_swigregister
SSD1308_swigregister(SSD1308)
DISPLAY_CMD_SET_NORMAL_1308 = cvar.DISPLAY_CMD_SET_NORMAL_1308
[docs]class SSD1327(LCD):
"""
API for SSD1327 I2C-controlled OLED displays.
ID: ssd1327
Name: OLED Display
Other Names: Grove OLED Display 1.12"
Category: display
Manufacturer: seeed adafruit
Link:http://wiki.seeed.cc/Grove-OLED_Display_1.12inch/
Connection: i2c SSD1327 is a 96x96 dot-matrix OLED/PLED segment
driver with a controller. This implementation was tested using the
Grove LED 96*96 Display module, which is an OLED monochrome display.
C++ includes: ssd1327.hpp
"""
__swig_setmethods__ = {}
for _s in [LCD]:
__swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {}))
__setattr__ = lambda self, name, value: _swig_setattr(self, SSD1327, name, value)
__swig_getmethods__ = {}
for _s in [LCD]:
__swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {}))
__getattr__ = lambda self, name: _swig_getattr(self, SSD1327, name)
__repr__ = _swig_repr
def __init__(self, bus, address=0x3C):
"""
SSD1327(int bus, int
address=0x3C)
SSD1327 constructor; calls libmraa initialisation functions
Parameters:
-----------
bus: I2C bus to use
address: Slave address the LCD is registered on
"""
this = _pyupm_lcd.new_SSD1327(bus, address)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_lcd.delete_SSD1327
__del__ = lambda self: None
[docs] def draw(self, data, bytes):
"""
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:
-----------
data: Buffer to read
bytes: Number of bytes to read from the pointer
Result of the operation
"""
return _pyupm_lcd.SSD1327_draw(self, data, bytes)
[docs] def setGrayLevel(self, level):
"""
void
setGrayLevel(uint8_t level)
Sets the gray level for the LCD panel
Parameters:
-----------
level: level from 0 to 255
Result of the operation
"""
return _pyupm_lcd.SSD1327_setGrayLevel(self, level)
[docs] def write(self, msg):
"""
mraa::Result
write(std::string msg)
Writes a string to the LCD
Parameters:
-----------
msg: std::string to write to the display; note: only ASCII characters
are supported
Result of the operation
"""
return _pyupm_lcd.SSD1327_write(self, msg)
[docs] def setCursor(self, row, column):
"""
mraa::Result
setCursor(int row, int column)
Sets the cursor to specified coordinates
Parameters:
-----------
row: Row to set the cursor to
column: Column to set the cursor to
Result of the operation
"""
return _pyupm_lcd.SSD1327_setCursor(self, row, column)
[docs] def clear(self):
"""
mraa::Result clear()
Clears the display of all characters
Result of the operation
"""
return _pyupm_lcd.SSD1327_clear(self)
[docs] def home(self):
"""
mraa::Result home()
Returns to the original coordinates (0,0)
Result of the operation
"""
return _pyupm_lcd.SSD1327_home(self)
SSD1327_swigregister = _pyupm_lcd.SSD1327_swigregister
SSD1327_swigregister(SSD1327)
DISPLAY_CMD_SET_NORMAL = cvar.DISPLAY_CMD_SET_NORMAL
_pyupm_lcd.HORIZONTAL_swigconstant(_pyupm_lcd)
HORIZONTAL = _pyupm_lcd.HORIZONTAL
_pyupm_lcd.VERTICAL_swigconstant(_pyupm_lcd)
VERTICAL = _pyupm_lcd.VERTICAL
_pyupm_lcd.PAGE_swigconstant(_pyupm_lcd)
PAGE = _pyupm_lcd.PAGE
# This file is compatible with both classic and new-style classes.
DISPLAY_CMD_OFF = cvar.DISPLAY_CMD_OFF
DISPLAY_CMD_ON = cvar.DISPLAY_CMD_ON
BASE_LOW_COLUMN_ADDR = cvar.BASE_LOW_COLUMN_ADDR
BASE_HIGH_COLUMN_ADDR = cvar.BASE_HIGH_COLUMN_ADDR
BASE_PAGE_START_ADDR = cvar.BASE_PAGE_START_ADDR
DISPLAY_CMD_MEM_ADDR_MODE = cvar.DISPLAY_CMD_MEM_ADDR_MODE
BasicFont = cvar.BasicFont