Source code for pyupm_ssd1351

# 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_ssd1351', [dirname(__file__)])
        except ImportError:
            import _pyupm_ssd1351
            return _pyupm_ssd1351
        if fp is not None:
            try:
                _mod = imp.load_module('_pyupm_ssd1351', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _pyupm_ssd1351 = swig_import_helper()
    del swig_import_helper
else:
    import _pyupm_ssd1351
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_ssd1351.getVersion()
getVersion = _pyupm_ssd1351.getVersion
[docs]class GFX(_object): """ GFX helper class. This file is used by the screen. C++ includes: ili9341_gfx.hpp """ __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, GFX, name, value) __swig_getmethods__ = {} __getattr__ = lambda self, name: _swig_getattr(self, GFX, name) def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined - class is abstract") __repr__ = _swig_repr __swig_destroy__ = _pyupm_ssd1351.delete_GFX __del__ = lambda self: None
[docs] def drawPixel(self, x, y, color): """ virtual void drawPixel(int16_t x, int16_t y, uint16_t color)=0 Sends a pixel color (RGB) to the chip. Must be implemented by the inherited class. Parameters: ----------- x: Axis on the horizontal scale y: Axis on the vertical scale color: RGB value """ return _pyupm_ssd1351.GFX_drawPixel(self, x, y, color)
[docs] def refresh(self): """ virtual void refresh()=0 Copies the buffer to the chip via the SPI. """ return _pyupm_ssd1351.GFX_refresh(self)
[docs] def drawChar(self, x, y, data, color, bg, size): """ void drawChar(int16_t x, int16_t y, uint8_t data, uint16_t color, uint16_t bg, uint8_t size) Parameters: ----------- x: Axis on the horizontal scale y: Axis on the vertical scale data: Character to write color: Character color bg: Character background color size: Size of the font """ return _pyupm_ssd1351.GFX_drawChar(self, x, y, data, color, bg, size)
def _print(self, msg): """ void print(std::string msg) Prints a message on the screen Parameters: ----------- msg: Message to print """ return _pyupm_ssd1351.GFX__print(self, msg)
[docs] def fillScreen(self, color): """ void fillScreen(uint16_t color) Fills the screen with a selected color Parameters: ----------- color: Selected color """ return _pyupm_ssd1351.GFX_fillScreen(self, color)
[docs] def fillRect(self, x, y, w, h, color): """ void fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) Fills a rectangle with a selected color Parameters: ----------- x: Axis on the horizontal scale (top-left corner) y: Axis on the vertical scale (top-left corner) w: Distanse from x h: Distanse from y color: Selected color """ return _pyupm_ssd1351.GFX_fillRect(self, x, y, w, h, color)
[docs] def drawFastVLine(self, x, y, h, color): """ void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) Draws a line on the vertical scale Parameters: ----------- x: Axis on the horizontal scale y: Axis on the vertical scale h: Distanse from y color: Selected color """ return _pyupm_ssd1351.GFX_drawFastVLine(self, x, y, h, color)
[docs] def drawLine(self, x0, y0, x1, y1, color): """ void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) Draws a line from coordinate C0 to coordinate C1 Parameters: ----------- x0: First coordinate y0: First coordinate x1: Second coordinate y1: Second coordinate color: selected color """ return _pyupm_ssd1351.GFX_drawLine(self, x0, y0, x1, y1, color)
[docs] def drawTriangle(self, x0, y0, x1, y1, x2, y2, color): """ 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 Parameters: ----------- x0: First coordinate y0: First coordinate x1: Second coordinate y1: Second coordinate x2: Third coordinate y2: Third coordinate color: Selected color """ return _pyupm_ssd1351.GFX_drawTriangle(self, x0, y0, x1, y1, x2, y2, color)
[docs] def drawCircle(self, x, y, r, color): """ void drawCircle(int16_t x, int16_t y, int16_t r, uint16_t color) Draws a circle Parameters: ----------- x: Center of the circle on the horizontal scale y: Center of the circle on the vertical scale r: Radius of the circle color: Color of the circle """ return _pyupm_ssd1351.GFX_drawCircle(self, x, y, r, color)
[docs] def setCursor(self, x, y): """ void setCursor(int16_t x, int16_t y) Sets the cursor for a text message Parameters: ----------- x: Axis on the horizontal scale y: Axis on the vertical scale """ return _pyupm_ssd1351.GFX_setCursor(self, x, y)
[docs] def setTextColor(self, textColor, textBGColor): """ void setTextColor(uint16_t textColor, uint16_t textBGColor) Sets a text color for a message Parameters: ----------- textColor: Font color textBGColor: Background color """ return _pyupm_ssd1351.GFX_setTextColor(self, textColor, textBGColor)
[docs] def setTextSize(self, size): """ void setTextSize(uint8_t size) Sets the size of the font Parameters: ----------- size: Font size """ return _pyupm_ssd1351.GFX_setTextSize(self, size)
[docs] def setTextWrap(self, wrap): """ void setTextWrap(uint8_t wrap) Wraps a printed message Parameters: ----------- wrap: True (0x1) or false (0x0) """ return _pyupm_ssd1351.GFX_setTextWrap(self, wrap)
GFX_swigregister = _pyupm_ssd1351.GFX_swigregister GFX_swigregister(GFX) cvar = _pyupm_ssd1351.cvar font = cvar.font _pyupm_ssd1351.SSD1351WIDTH_swigconstant(_pyupm_ssd1351) SSD1351WIDTH = _pyupm_ssd1351.SSD1351WIDTH _pyupm_ssd1351.SSD1351HEIGHT_swigconstant(_pyupm_ssd1351) SSD1351HEIGHT = _pyupm_ssd1351.SSD1351HEIGHT _pyupm_ssd1351.SSD1351_CMD_SETCOLUMN_swigconstant(_pyupm_ssd1351) SSD1351_CMD_SETCOLUMN = _pyupm_ssd1351.SSD1351_CMD_SETCOLUMN _pyupm_ssd1351.SSD1351_CMD_SETROW_swigconstant(_pyupm_ssd1351) SSD1351_CMD_SETROW = _pyupm_ssd1351.SSD1351_CMD_SETROW _pyupm_ssd1351.SSD1351_CMD_WRITERAM_swigconstant(_pyupm_ssd1351) SSD1351_CMD_WRITERAM = _pyupm_ssd1351.SSD1351_CMD_WRITERAM _pyupm_ssd1351.SSD1351_CMD_READRAM_swigconstant(_pyupm_ssd1351) SSD1351_CMD_READRAM = _pyupm_ssd1351.SSD1351_CMD_READRAM _pyupm_ssd1351.SSD1351_CMD_SETREMAP_swigconstant(_pyupm_ssd1351) SSD1351_CMD_SETREMAP = _pyupm_ssd1351.SSD1351_CMD_SETREMAP _pyupm_ssd1351.SSD1351_CMD_STARTLINE_swigconstant(_pyupm_ssd1351) SSD1351_CMD_STARTLINE = _pyupm_ssd1351.SSD1351_CMD_STARTLINE _pyupm_ssd1351.SSD1351_CMD_DISPLAYOFFSET_swigconstant(_pyupm_ssd1351) SSD1351_CMD_DISPLAYOFFSET = _pyupm_ssd1351.SSD1351_CMD_DISPLAYOFFSET _pyupm_ssd1351.SSD1351_CMD_DISPLAYALLOFF_swigconstant(_pyupm_ssd1351) SSD1351_CMD_DISPLAYALLOFF = _pyupm_ssd1351.SSD1351_CMD_DISPLAYALLOFF _pyupm_ssd1351.SSD1351_CMD_DISPLAYALLON_swigconstant(_pyupm_ssd1351) SSD1351_CMD_DISPLAYALLON = _pyupm_ssd1351.SSD1351_CMD_DISPLAYALLON _pyupm_ssd1351.SSD1351_CMD_NORMALDISPLAY_swigconstant(_pyupm_ssd1351) SSD1351_CMD_NORMALDISPLAY = _pyupm_ssd1351.SSD1351_CMD_NORMALDISPLAY _pyupm_ssd1351.SSD1351_CMD_INVERTDISPLAY_swigconstant(_pyupm_ssd1351) SSD1351_CMD_INVERTDISPLAY = _pyupm_ssd1351.SSD1351_CMD_INVERTDISPLAY _pyupm_ssd1351.SSD1351_CMD_FUNCTIONSELECT_swigconstant(_pyupm_ssd1351) SSD1351_CMD_FUNCTIONSELECT = _pyupm_ssd1351.SSD1351_CMD_FUNCTIONSELECT _pyupm_ssd1351.SSD1351_CMD_DISPLAYOFF_swigconstant(_pyupm_ssd1351) SSD1351_CMD_DISPLAYOFF = _pyupm_ssd1351.SSD1351_CMD_DISPLAYOFF _pyupm_ssd1351.SSD1351_CMD_DISPLAYON_swigconstant(_pyupm_ssd1351) SSD1351_CMD_DISPLAYON = _pyupm_ssd1351.SSD1351_CMD_DISPLAYON _pyupm_ssd1351.SSD1351_CMD_PRECHARGE_swigconstant(_pyupm_ssd1351) SSD1351_CMD_PRECHARGE = _pyupm_ssd1351.SSD1351_CMD_PRECHARGE _pyupm_ssd1351.SSD1351_CMD_DISPLAYENHANCE_swigconstant(_pyupm_ssd1351) SSD1351_CMD_DISPLAYENHANCE = _pyupm_ssd1351.SSD1351_CMD_DISPLAYENHANCE _pyupm_ssd1351.SSD1351_CMD_CLOCKDIV_swigconstant(_pyupm_ssd1351) SSD1351_CMD_CLOCKDIV = _pyupm_ssd1351.SSD1351_CMD_CLOCKDIV _pyupm_ssd1351.SSD1351_CMD_SETVSL_swigconstant(_pyupm_ssd1351) SSD1351_CMD_SETVSL = _pyupm_ssd1351.SSD1351_CMD_SETVSL _pyupm_ssd1351.SSD1351_CMD_SETGPIO_swigconstant(_pyupm_ssd1351) SSD1351_CMD_SETGPIO = _pyupm_ssd1351.SSD1351_CMD_SETGPIO _pyupm_ssd1351.SSD1351_CMD_PRECHARGE2_swigconstant(_pyupm_ssd1351) SSD1351_CMD_PRECHARGE2 = _pyupm_ssd1351.SSD1351_CMD_PRECHARGE2 _pyupm_ssd1351.SSD1351_CMD_SETGRAY_swigconstant(_pyupm_ssd1351) SSD1351_CMD_SETGRAY = _pyupm_ssd1351.SSD1351_CMD_SETGRAY _pyupm_ssd1351.SSD1351_CMD_USELUT_swigconstant(_pyupm_ssd1351) SSD1351_CMD_USELUT = _pyupm_ssd1351.SSD1351_CMD_USELUT _pyupm_ssd1351.SSD1351_CMD_PRECHARGELEVEL_swigconstant(_pyupm_ssd1351) SSD1351_CMD_PRECHARGELEVEL = _pyupm_ssd1351.SSD1351_CMD_PRECHARGELEVEL _pyupm_ssd1351.SSD1351_CMD_VCOMH_swigconstant(_pyupm_ssd1351) SSD1351_CMD_VCOMH = _pyupm_ssd1351.SSD1351_CMD_VCOMH _pyupm_ssd1351.SSD1351_CMD_CONTRASTABC_swigconstant(_pyupm_ssd1351) SSD1351_CMD_CONTRASTABC = _pyupm_ssd1351.SSD1351_CMD_CONTRASTABC _pyupm_ssd1351.SSD1351_CMD_CONTRASTMASTER_swigconstant(_pyupm_ssd1351) SSD1351_CMD_CONTRASTMASTER = _pyupm_ssd1351.SSD1351_CMD_CONTRASTMASTER _pyupm_ssd1351.SSD1351_CMD_MUXRATIO_swigconstant(_pyupm_ssd1351) SSD1351_CMD_MUXRATIO = _pyupm_ssd1351.SSD1351_CMD_MUXRATIO _pyupm_ssd1351.SSD1351_CMD_COMMANDLOCK_swigconstant(_pyupm_ssd1351) SSD1351_CMD_COMMANDLOCK = _pyupm_ssd1351.SSD1351_CMD_COMMANDLOCK _pyupm_ssd1351.SSD1351_CMD_HORIZSCROLL_swigconstant(_pyupm_ssd1351) SSD1351_CMD_HORIZSCROLL = _pyupm_ssd1351.SSD1351_CMD_HORIZSCROLL _pyupm_ssd1351.SSD1351_CMD_STOPSCROLL_swigconstant(_pyupm_ssd1351) SSD1351_CMD_STOPSCROLL = _pyupm_ssd1351.SSD1351_CMD_STOPSCROLL _pyupm_ssd1351.SSD1351_CMD_STARTSCROLL_swigconstant(_pyupm_ssd1351) SSD1351_CMD_STARTSCROLL = _pyupm_ssd1351.SSD1351_CMD_STARTSCROLL _pyupm_ssd1351.HIGH_swigconstant(_pyupm_ssd1351) HIGH = _pyupm_ssd1351.HIGH _pyupm_ssd1351.LOW_swigconstant(_pyupm_ssd1351) LOW = _pyupm_ssd1351.LOW _pyupm_ssd1351.BLOCKS_swigconstant(_pyupm_ssd1351) BLOCKS = _pyupm_ssd1351.BLOCKS
[docs]class SSD1351(GFX): """ API for SSD1351 OLED displays. ID: ssd1351 Name: SPI-based OLED Display Category: display Manufacturer: adafruit Link:http://www.adafruit.com/products/1431 Connection: spi 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 C++ includes: ssd1351.hpp """ __swig_setmethods__ = {} for _s in [GFX]: __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) __setattr__ = lambda self, name, value: _swig_setattr(self, SSD1351, name, value) __swig_getmethods__ = {} for _s in [GFX]: __swig_getmethods__.update(getattr(_s, '__swig_getmethods__', {})) __getattr__ = lambda self, name: _swig_getattr(self, SSD1351, name) __repr__ = _swig_repr def __init__(self, oc, dc, rst): """ SSD1351(int oc, int dc, int rst) Instantiates an SSD1351 object Parameters: ----------- oc: LCD chip select pin dc: Data/command pin rst: Reset pin """ this = _pyupm_ssd1351.new_SSD1351(oc, dc, rst) try: self.this.append(this) except Exception: self.this = this __swig_destroy__ = _pyupm_ssd1351.delete_SSD1351 __del__ = lambda self: None
[docs] def name(self): """ std::string name() Returns the name of the component """ return _pyupm_ssd1351.SSD1351_name(self)
[docs] def writeCommand(self, value): """ void writeCommand(uint8_t value) Sends a command to an SPI bus Parameters: ----------- value: Command """ return _pyupm_ssd1351.SSD1351_writeCommand(self, value)
[docs] def writeData(self, value): """ void writeData(uint8_t value) Sends data to an SPI bus Parameters: ----------- value: Data """ return _pyupm_ssd1351.SSD1351_writeData(self, value)
[docs] def drawPixel(self, x, y, color): """ void drawPixel(int16_t x, int16_t y, uint16_t color) Sends a pixel color (RGB) to the display buffer or chip Parameters: ----------- x: Axis on the horizontal scale y: Axis on the vertical scale color: RGB (16-bit) color (R[0-4], G[5-10], B[11-15]) """ return _pyupm_ssd1351.SSD1351_drawPixel(self, x, y, color)
[docs] def refresh(self): """ void refresh() Copies the buffer to the chip via the SPI bus """ return _pyupm_ssd1351.SSD1351_refresh(self)
[docs] def ocLow(self): """ void ocLow() Set OLED chip select LOW """ return _pyupm_ssd1351.SSD1351_ocLow(self)
[docs] def ocHigh(self): """ void ocHigh() Set OLED chip select HIGH """ return _pyupm_ssd1351.SSD1351_ocHigh(self)
[docs] def dcLow(self): """ void dcLow() Data select LOW """ return _pyupm_ssd1351.SSD1351_dcLow(self)
[docs] def dcHigh(self): """ void dcHigh() Data select HIGH """ return _pyupm_ssd1351.SSD1351_dcHigh(self)
[docs] def useMemoryMap(self, var): """ void useMemoryMap(bool var) Use memory mapped (buffered) writes to the display Parameters: ----------- var: true for yes (default), false for no """ return _pyupm_ssd1351.SSD1351_useMemoryMap(self, var)
SSD1351_swigregister = _pyupm_ssd1351.SSD1351_swigregister SSD1351_swigregister(SSD1351) # This file is compatible with both classic and new-style classes.