# 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_at42qt1070', [dirname(__file__)])
except ImportError:
import _pyupm_at42qt1070
return _pyupm_at42qt1070
if fp is not None:
try:
_mod = imp.load_module('_pyupm_at42qt1070', fp, pathname, description)
finally:
fp.close()
return _mod
_pyupm_at42qt1070 = swig_import_helper()
del swig_import_helper
else:
import _pyupm_at42qt1070
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_at42qt1070.getVersion()
getVersion = _pyupm_at42qt1070.getVersion
_pyupm_at42qt1070.AT42QT1070_I2C_BUS_swigconstant(_pyupm_at42qt1070)
AT42QT1070_I2C_BUS = _pyupm_at42qt1070.AT42QT1070_I2C_BUS
_pyupm_at42qt1070.AT42QT1070_DEFAULT_I2C_ADDR_swigconstant(_pyupm_at42qt1070)
AT42QT1070_DEFAULT_I2C_ADDR = _pyupm_at42qt1070.AT42QT1070_DEFAULT_I2C_ADDR
[docs]class AT42QT1070(_object):
"""
API for the Atmel AT42QT1070 QTouch Sensor.
ID: at42qt1070
Name: Seven-channel QTouch Touch Sensor
Other Names: Grove QTouch Sensor
Category: touch
Manufacturer: seeed
Connection: i2c
Link:http://wiki.seeed.cc/Grove-Q_Touch_Sensor/ This class implements
support for the Atmel AT42QT1070 QTouch sensor, which supports 7
capacitive buttons.
It was developed using a Grove-Q Touch Sensor board.
C++ includes: at42qt1070.hpp
"""
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, AT42QT1070, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, AT42QT1070, name)
__repr__ = _swig_repr
REG_CHIPID = _pyupm_at42qt1070.AT42QT1070_REG_CHIPID
REG_FWVERS = _pyupm_at42qt1070.AT42QT1070_REG_FWVERS
REG_DETSTATUS = _pyupm_at42qt1070.AT42QT1070_REG_DETSTATUS
REG_KEYSTATUS = _pyupm_at42qt1070.AT42QT1070_REG_KEYSTATUS
REG_KEYSIG0_H = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG0_H
REG_KEYSIG0_L = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG0_L
REG_KEYSIG1_H = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG1_H
REG_KEYSIG1_L = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG1_L
REG_KEYSIG2_H = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG2_H
REG_KEYSIG2_L = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG2_L
REG_KEYSIG3_H = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG3_H
REG_KEYSIG3_L = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG3_L
REG_KEYSIG4_H = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG4_H
REG_KEYSIG4_L = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG4_L
REG_KEYSIG5_H = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG5_H
REG_KEYSIG5_L = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG5_L
REG_KEYSIG6_H = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG6_H
REG_KEYSIG6_L = _pyupm_at42qt1070.AT42QT1070_REG_KEYSIG6_L
REG_REFDATA0_H = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA0_H
REG_REFDATA0_L = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA0_L
REG_REFDATA1_H = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA1_H
REG_REFDATA1_L = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA1_L
REG_REFDATA2_H = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA2_H
REG_REFDATA2_L = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA2_L
REG_REFDATA3_H = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA3_H
REG_REFDATA3_L = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA3_L
REG_REFDATA4_H = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA4_H
REG_REFDATA4_L = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA4_L
REG_REFDATA5_H = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA5_H
REG_REFDATA5_L = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA5_L
REG_REFDATA6_H = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA6_H
REG_REFDATA6_L = _pyupm_at42qt1070.AT42QT1070_REG_REFDATA6_L
REG_NTHR0 = _pyupm_at42qt1070.AT42QT1070_REG_NTHR0
REG_NTHR1 = _pyupm_at42qt1070.AT42QT1070_REG_NTHR1
REG_NTHR2 = _pyupm_at42qt1070.AT42QT1070_REG_NTHR2
REG_NTHR3 = _pyupm_at42qt1070.AT42QT1070_REG_NTHR3
REG_NTHR4 = _pyupm_at42qt1070.AT42QT1070_REG_NTHR4
REG_NTHR5 = _pyupm_at42qt1070.AT42QT1070_REG_NTHR5
REG_NTHR6 = _pyupm_at42qt1070.AT42QT1070_REG_NTHR6
REG_AVE0 = _pyupm_at42qt1070.AT42QT1070_REG_AVE0
REG_AVE1 = _pyupm_at42qt1070.AT42QT1070_REG_AVE1
REG_AVE2 = _pyupm_at42qt1070.AT42QT1070_REG_AVE2
REG_AVE3 = _pyupm_at42qt1070.AT42QT1070_REG_AVE3
REG_AVE4 = _pyupm_at42qt1070.AT42QT1070_REG_AVE4
REG_AVE5 = _pyupm_at42qt1070.AT42QT1070_REG_AVE5
REG_AVE6 = _pyupm_at42qt1070.AT42QT1070_REG_AVE6
REG_DI0 = _pyupm_at42qt1070.AT42QT1070_REG_DI0
REG_DI1 = _pyupm_at42qt1070.AT42QT1070_REG_DI1
REG_DI2 = _pyupm_at42qt1070.AT42QT1070_REG_DI2
REG_DI3 = _pyupm_at42qt1070.AT42QT1070_REG_DI3
REG_DI4 = _pyupm_at42qt1070.AT42QT1070_REG_DI4
REG_DI5 = _pyupm_at42qt1070.AT42QT1070_REG_DI5
REG_DI6 = _pyupm_at42qt1070.AT42QT1070_REG_DI6
REG_GUARD = _pyupm_at42qt1070.AT42QT1070_REG_GUARD
REG_LP = _pyupm_at42qt1070.AT42QT1070_REG_LP
REG_MAXON = _pyupm_at42qt1070.AT42QT1070_REG_MAXON
REG_CALIBRATE = _pyupm_at42qt1070.AT42QT1070_REG_CALIBRATE
REG_RESET = _pyupm_at42qt1070.AT42QT1070_REG_RESET
DET_TOUCH = _pyupm_at42qt1070.AT42QT1070_DET_TOUCH
DET_OVERFLOW = _pyupm_at42qt1070.AT42QT1070_DET_OVERFLOW
DET_CALIBRATE = _pyupm_at42qt1070.AT42QT1070_DET_CALIBRATE
def __init__(self, bus, address=0x1b):
"""
AT42QT1070(int
bus, uint8_t address=AT42QT1070_DEFAULT_I2C_ADDR)
AT42QT1070 constructor
Parameters:
-----------
bus: I2C bus to use
address: Address for this sensor
"""
this = _pyupm_at42qt1070.new_AT42QT1070(bus, address)
try:
self.this.append(this)
except Exception:
self.this = this
__swig_destroy__ = _pyupm_at42qt1070.delete_AT42QT1070
__del__ = lambda self: None
[docs] def writeByte(self, reg, byte):
"""
bool
writeByte(uint8_t reg, uint8_t byte)
Writes a byte value into the register
Parameters:
-----------
reg: Register location to write into
byte: Byte to write
True if successful
"""
return _pyupm_at42qt1070.AT42QT1070_writeByte(self, reg, byte)
[docs] def writeWord(self, reg, word):
"""
bool
writeWord(uint8_t reg, uint16_t word)
Writes a word value into the register. Note: the device must have the
auto-increment bit set in the MODE1 register to work.
Parameters:
-----------
reg: Register location to write into
word: Word to write
True if successful
"""
return _pyupm_at42qt1070.AT42QT1070_writeWord(self, reg, word)
[docs] def readByte(self, reg):
"""
uint8_t
readByte(uint8_t reg)
Read a byte value from the register
Parameters:
-----------
reg: Register location to read from
Value in the specified register
"""
return _pyupm_at42qt1070.AT42QT1070_readByte(self, reg)
[docs] def readWord(self, reg):
"""
uint16_t
readWord(uint8_t reg)
Read a word value from the register. Note: the device must have the
auto-increment bit set in the MODE1 register to work.
Parameters:
-----------
reg: Register location to read from
Value in the specified register
"""
return _pyupm_at42qt1070.AT42QT1070_readWord(self, reg)
[docs] def readChipID(self):
"""
uint8_t
readChipID(void)
Reads the Chip ID register on the sensor
Value of the Chip ID register
"""
return _pyupm_at42qt1070.AT42QT1070_readChipID(self)
[docs] def updateState(self):
"""
void
updateState()
Reads the current touch status and detection state
Key status bits for all keys (0-6)
"""
return _pyupm_at42qt1070.AT42QT1070_updateState(self)
[docs] def getLPMode(self):
"""
uint8_t
getLPMode(void)
Reads the current low-power mode setting
Low-power mode setting from the sensor
"""
return _pyupm_at42qt1070.AT42QT1070_getLPMode(self)
[docs] def setLPMode(self, mode):
"""
uint8_t
setLPMode(uint8_t mode)
Changes the low-pomer mode setting on the sensor
Parameters:
-----------
mode: dDsired new mode
New setting on the sensor
"""
return _pyupm_at42qt1070.AT42QT1070_setLPMode(self, mode)
[docs] def getAVE(self, key):
"""
uint8_t
getAVE(uint8_t key)
Reads the current averaging factor setting for a key
Parameters:
-----------
key: Key being read
Averaging factor
"""
return _pyupm_at42qt1070.AT42QT1070_getAVE(self, key)
[docs] def setAVE(self, key, ave):
"""
uint8_t
setAVE(uint8_t key, uint8_t ave)
Changes the averaging factor setting for a key
Parameters:
-----------
key: Key being changed
ave: New averaging factor
New averaging factor as read from the device
"""
return _pyupm_at42qt1070.AT42QT1070_setAVE(self, key, ave)
[docs] def getAKSGroup(self, key):
"""
uint8_t
getAKSGroup(uint8_t key)
Reads the AKS group of which a key is part
Parameters:
-----------
key: Key (0-6) being queried
AKS group of which the key is part
"""
return _pyupm_at42qt1070.AT42QT1070_getAKSGroup(self, key)
[docs] def setAKSGroup(self, key, group):
"""
uint8_t
setAKSGroup(uint8_t key, uint8_t group)
Changes the AKS group of which a key is part
Parameters:
-----------
key: Key (0-6) being changed
group: New group for the key
New value on the sensor
"""
return _pyupm_at42qt1070.AT42QT1070_setAKSGroup(self, key, group)
[docs] def isOverflowed(self):
"""
bool
isOverflowed()
Returns the overflow indicator
True if overflow is indicated
"""
return _pyupm_at42qt1070.AT42QT1070_isOverflowed(self)
[docs] def isCalibrating(self):
"""
bool
isCalibrating()
Returns the calibrating indicator
True if calibration is in progress
"""
return _pyupm_at42qt1070.AT42QT1070_isCalibrating(self)
[docs] def reset(self):
"""
bool reset()
Issues a reset command
True if successful
"""
return _pyupm_at42qt1070.AT42QT1070_reset(self)
[docs] def calibrate(self):
"""
bool calibrate()
Issues a calibrate command
True if successful
"""
return _pyupm_at42qt1070.AT42QT1070_calibrate(self)
AT42QT1070_swigregister = _pyupm_at42qt1070.AT42QT1070_swigregister
AT42QT1070_swigregister(AT42QT1070)
# This file is compatible with both classic and new-style classes.