# 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_p9813', [dirname(__file__)])
except ImportError:
import _pyupm_p9813
return _pyupm_p9813
if fp is not None:
try:
_mod = imp.load_module('_pyupm_p9813', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_p9813 = swig_import_helper()
del swig_import_helper
else:
import _pyupm_p9813
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_p9813.getVersion()
getVersion = _pyupm_p9813.getVersion
[docs]class RgbColor(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, RgbColor, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, RgbColor, name)
__repr__ = _swig_repr
__swig_setmethods__["red"] = _pyupm_p9813.RgbColor_red_set
__swig_getmethods__["red"] = _pyupm_p9813.RgbColor_red_get
if _newclass:
red = _swig_property(_pyupm_p9813.RgbColor_red_get, _pyupm_p9813.RgbColor_red_set)
__swig_setmethods__["green"] = _pyupm_p9813.RgbColor_green_set
__swig_getmethods__["green"] = _pyupm_p9813.RgbColor_green_get
if _newclass:
green = _swig_property(_pyupm_p9813.RgbColor_green_get, _pyupm_p9813.RgbColor_green_set)
__swig_setmethods__["blue"] = _pyupm_p9813.RgbColor_blue_set
__swig_getmethods__["blue"] = _pyupm_p9813.RgbColor_blue_get
if _newclass:
blue = _swig_property(_pyupm_p9813.RgbColor_blue_get, _pyupm_p9813.RgbColor_blue_set)
def __init__(self):
this = _pyupm_p9813.new_RgbColor()
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_p9813.delete_RgbColor
__del__ = lambda self: None
RgbColor_swigregister = _pyupm_p9813.RgbColor_swigregister
RgbColor_swigregister(RgbColor)
[docs]class P9813(_object):
"""
API for controlling P9813/Chainable RGB LEDs.
ID: p9813
Name: Chainable RGB LED driver
Category: led
Manufacturer: adafruit
Connection: gpio
Link:https://www.adafruit.com/product/2343 P9813 LED controller
provides individually controllable LEDs through a two pin protocol For
each LED, an RGB (0-255) value can be set.
C++ includes: p9813.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, P9813, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, P9813, name)
__repr__ = _swig_repr
def __init__(self, ledCount, clkPin, dataPin, batchMode=False):
"""
P9813(uint16_t ledCount,
uint16_t clkPin, uint16_t dataPin, bool batchMode=false)
Instantiates a new P9813 LED chain
Parameters:
-----------
ledCount: Number of P9813 leds in the chain
clkPin: Clock Pin
dataPin: Data Pin
batchMode: (optional) Immediately write to the LED controllers
(false, default) or wait for a pushState call (true)
"""
this = _pyupm_p9813.new_P9813(ledCount, clkPin, dataPin, batchMode)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_p9813.delete_P9813
__del__ = lambda self: None
[docs] def setLed(self, ledIdx, r, g, b):
"""
void setLed(uint16_t
ledIdx, uint8_t r, uint8_t g, uint8_t b)
Set the color for a single LED
Parameters:
-----------
ledIdx: Index of the LED in the chain (0 based)
r: Red component (0-255)
g: Green component (0-255)
b: Blue component (0-255)
"""
return _pyupm_p9813.P9813_setLed(self, ledIdx, r, g, b)
[docs] def setAllLeds(self, r, g, b):
"""
void
setAllLeds(uint8_t r, uint8_t g, uint8_t b)
Set the color for all LEDs
Parameters:
-----------
r: Red component (0-255)
g: Green component (0-255)
b: Blue component (0-255)
"""
return _pyupm_p9813.P9813_setAllLeds(self, r, g, b)
[docs] def setLeds(self, *args):
"""
void setLeds(uint16_t
startIdx, uint16_t endIdx, std::vector< RgbColor > colors)
(Advanced) Manually control the colors and brightness of a range of
LEDS Best used to maximize performance
Parameters:
-----------
startIdx: Start index of the range of LEDs to update (0 based)
endIdx: End index of the range of LEDs to update (0 based)
colors: Vector containing RgbColor structures for each LED No check
done on the boundaries
"""
return _pyupm_p9813.P9813_setLeds(self, *args)
[docs] def pushState(self):
"""
void pushState()
Outputs the current LED data to the LED controllers Note: Only
required if batch mode is set to TRUE
"""
return _pyupm_p9813.P9813_pushState(self)
P9813_swigregister = _pyupm_p9813.P9813_swigregister
P9813_swigregister(P9813)
# This file is compatible with both classic and new-style classes.