speed to argument
This commit is contained in:
parent
960588f527
commit
348d8a65f7
@ -4,12 +4,12 @@ import RPi.GPIO
|
|||||||
|
|
||||||
class AD7843(object):
|
class AD7843(object):
|
||||||
"""AD7843 class"""
|
"""AD7843 class"""
|
||||||
def __init__(self, width, height, int_pin=None, callback=None, spi=0):
|
def __init__(self, width, height, int_pin=None, callback=None, spi=0, speed=2000000):
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
self.spi = spidev.SpiDev()
|
self.spi = spidev.SpiDev()
|
||||||
self.spi.open(spi, 0)
|
self.spi.open(spi, 0)
|
||||||
self.spi.max_speed_hz = 2000000
|
self.spi.max_speed_hz = speed
|
||||||
self.spi.mode = 0
|
self.spi.mode = 0
|
||||||
self.correction = {
|
self.correction = {
|
||||||
'x': 364,
|
'x': 364,
|
||||||
@ -58,7 +58,7 @@ class AD7843(object):
|
|||||||
|
|
||||||
pos_x = self.get_x(tc_rx)
|
pos_x = self.get_x(tc_rx)
|
||||||
pos_y = self.get_y(tc_ry)
|
pos_y = self.get_y(tc_ry)
|
||||||
if 0 <= pos_x <= self.width and 0 <= pos_y <= self.height:
|
if 0 <= pos_x <= self.width and 0 <= pos_y <= self.height:
|
||||||
buffer.append((pos_x, pos_y))
|
buffer.append((pos_x, pos_y))
|
||||||
|
|
||||||
return self._calculate_avr(buffer)
|
return self._calculate_avr(buffer)
|
||||||
|
Loading…
Reference in New Issue
Block a user