From 348d8a65f7a764f04385c6db92eda42d1be71b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Ko=C5=9Bci=C3=B3w?= Date: Fri, 5 May 2017 11:58:41 +0200 Subject: [PATCH] speed to argument --- gfxlcd/driver/ad7843/ad7853.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gfxlcd/driver/ad7843/ad7853.py b/gfxlcd/driver/ad7843/ad7853.py index 2a0c35e..7e9e56b 100644 --- a/gfxlcd/driver/ad7843/ad7853.py +++ b/gfxlcd/driver/ad7843/ad7853.py @@ -4,12 +4,12 @@ import RPi.GPIO class AD7843(object): """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.height = height self.spi = spidev.SpiDev() self.spi.open(spi, 0) - self.spi.max_speed_hz = 2000000 + self.spi.max_speed_hz = speed self.spi.mode = 0 self.correction = { 'x': 364, @@ -58,7 +58,7 @@ class AD7843(object): pos_x = self.get_x(tc_rx) 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)) return self._calculate_avr(buffer)