# 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_tm1637', [dirname(__file__)])
except ImportError:
import _pyupm_tm1637
return _pyupm_tm1637
if fp is not None:
try:
_mod = imp.load_module('_pyupm_tm1637', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_tm1637 = swig_import_helper()
del swig_import_helper
else:
import _pyupm_tm1637
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_tm1637.getVersion()
getVersion = _pyupm_tm1637.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_tm1637.new_uint8Array(nelements)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_tm1637.delete_uint8Array
__del__ = lambda self: None
def __getitem__(self, index):
return _pyupm_tm1637.uint8Array___getitem__(self, index)
def __setitem__(self, index, value):
return _pyupm_tm1637.uint8Array___setitem__(self, index, value)
[docs] def cast(self):
return _pyupm_tm1637.uint8Array_cast(self)
__swig_getmethods__["frompointer"] = lambda x: _pyupm_tm1637.uint8Array_frompointer
if _newclass:
frompointer = staticmethod(_pyupm_tm1637.uint8Array_frompointer)
uint8Array_swigregister = _pyupm_tm1637.uint8Array_swigregister
uint8Array_swigregister(uint8Array)
def uint8Array_frompointer(t):
return _pyupm_tm1637.uint8Array_frompointer(t)
uint8Array_frompointer = _pyupm_tm1637.uint8Array_frompointer
_pyupm_tm1637.TM1637_ADDR_swigconstant(_pyupm_tm1637)
TM1637_ADDR = _pyupm_tm1637.TM1637_ADDR
_pyupm_tm1637.TM1637_REG_swigconstant(_pyupm_tm1637)
TM1637_REG = _pyupm_tm1637.TM1637_REG
_pyupm_tm1637.TM1637_CMD_swigconstant(_pyupm_tm1637)
TM1637_CMD = _pyupm_tm1637.TM1637_CMD
_pyupm_tm1637.M_DISPLAY_DIGITS_swigconstant(_pyupm_tm1637)
M_DISPLAY_DIGITS = _pyupm_tm1637.M_DISPLAY_DIGITS
[docs]class TM1637(_object):
"""
API for the TM1637 7-Segment Display.
ID: tm1637
Name: 7-segment Display
Other Names: Grove 4-Digit Display
Category: display
Manufacturer: seeed
Link:http://wiki.seeed.cc/Grove-4-Digit_Display/
Connection: gpio TM1637 is a display controller for LED-based
7-segment displays. It can be used to address and write data to
multiple display digits. This driver is based on the Grove version of
the TM1637 display that uses 4 digits, thus making it ideal for clock
displays, timers, counters, or even score displays in a two-player
arcade game.
C++ includes: tm1637.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, TM1637, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, TM1637, name)
__repr__ = _swig_repr
NO = _pyupm_tm1637.TM1637_NO
YES = _pyupm_tm1637.TM1637_YES
def __init__(self, *args):
"""
TM1637(int clk_pin, int
dio_pin, int bright=3, M_FAST_GPIO mmio=YES)
TM1637 constructor
Parameters:
-----------
clk_pin: Clock pin the sensor is connected to
dio_pin: Data pin the sensor is connected to
bright: Initial brightness, from 0 (dark) to 7 (bright) (default is
3)
mmio: Fast memory-mapped GPIO writes; default is yes
"""
this = _pyupm_tm1637.new_TM1637(*args)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_tm1637.delete_TM1637
__del__ = lambda self: None
[docs] def writeArray(self, digits):
"""
mraa_result_t
write(std::string digits)
Writes all the digits or letters to the display as a string
Parameters:
-----------
digits: String of symbols to display
0 if successful, error code otherwise
"""
return _pyupm_tm1637.TM1637_writeArray(self, digits)
[docs] def write(self, d, digit1=0, digit2=0, digit3=0, digit4=0):
"""
mraa_result_t
write(std::string digits)
Writes all the digits or letters to the display as a string
Parameters:
-----------
digits: String of symbols to display
0 if successful, error code otherwise
"""
return _pyupm_tm1637.TM1637_write(self, d, digit1, digit2, digit3, digit4)
[docs] def writeAt(self, index, symbol):
"""
mraa_result_t
writeAt(int index, char symbol)
Writes a symbol (digit or letter) to the display in a specified index
Parameters:
-----------
index: 0-based index of the digit to change from the left
symbol: Digit or letter to display
0 if successful, error code otherwise
"""
return _pyupm_tm1637.TM1637_writeAt(self, index, symbol)
[docs] def writeString(self, digits):
"""
mraa_result_t
write(std::string digits)
Writes all the digits or letters to the display as a string
Parameters:
-----------
digits: String of symbols to display
0 if successful, error code otherwise
"""
return _pyupm_tm1637.TM1637_writeString(self, digits)
[docs] def setColon(self, value):
"""
void setColon(bool
value)
Toggles the colon between digits on the display
Parameters:
-----------
value: True to turn the colon on, false to turn it off
"""
return _pyupm_tm1637.TM1637_setColon(self, value)
[docs] def setBrightness(self, value):
"""
void
setBrightness(int value)
Controls the brightness of the display
Parameters:
-----------
value: Brightness, from 0 (darkest) to 7 (brightest)
"""
return _pyupm_tm1637.TM1637_setBrightness(self, value)
TM1637_swigregister = _pyupm_tm1637.TM1637_swigregister
TM1637_swigregister(TM1637)
# This file is compatible with both classic and new-style classes.