@@ -67,12 +67,14 @@ class Adafruit_FocalTouch:
67
67
_debug = False
68
68
chip = None
69
69
70
- def __init__ (self , i2c , address = _FT6206_DEFAULT_I2C_ADDR , debug = False , irq_pin = None ):
70
+ def __init__ (
71
+ self , i2c , address = _FT6206_DEFAULT_I2C_ADDR , debug = False , irq_pin = None
72
+ ):
71
73
self ._i2c = I2CDevice (i2c , address )
72
74
self ._debug = debug
73
75
self .irq_pin = irq_pin
74
76
75
- chip_data = self ._read (_FT6XXX_REG_LIBH , 8 ) # don't wait for IRQ
77
+ chip_data = self ._read (_FT6XXX_REG_LIBH , 8 ) # don't wait for IRQ
76
78
lib_ver , chip_id , _ , _ , firm_id , _ , vend_id = struct .unpack (
77
79
">HBBBBBB" , chip_data
78
80
)
@@ -91,7 +93,6 @@ def __init__(self, i2c, address=_FT6206_DEFAULT_I2C_ADDR, debug=False, irq_pin=N
91
93
print ("Point rate %d Hz" % self ._read (_FT6XXX_REG_POINTRATE , 1 )[0 ])
92
94
print ("Thresh %d" % self ._read (_FT6XXX_REG_THRESHHOLD , 1 )[0 ])
93
95
94
-
95
96
@property
96
97
def touched (self ):
97
98
""" Returns the number of touches currently detected """
@@ -127,8 +128,8 @@ def _read(self, register, length, irq_pin=None):
127
128
"""Returns an array of 'length' bytes from the 'register'"""
128
129
with self ._i2c as i2c :
129
130
130
- if ( irq_pin is not None ) :
131
- while ( self .irq_pin .value ) :
131
+ if irq_pin is not None :
132
+ while self .irq_pin .value :
132
133
pass
133
134
134
135
i2c .write (bytes ([register & 0xFF ]))
0 commit comments