Update epdconfig.py

This commit is contained in:
kmanc 2022-10-29 13:29:31 -07:00 committed by GitHub
parent 0d59a1227e
commit b6a218a8e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 16 deletions

View File

@ -37,10 +37,10 @@ logger = logging.getLogger(__name__)
class RaspberryPi:
# Pin definition
RST_PIN = 17
DC_PIN = 25
CS_PIN = 8
BUSY_PIN = 24
RST_PIN = 17
DC_PIN = 25
CS_PIN = 8
BUSY_PIN = 24
def __init__(self):
import spidev
@ -91,10 +91,10 @@ class RaspberryPi:
class JetsonNano:
# Pin definition
RST_PIN = 17
DC_PIN = 25
CS_PIN = 8
BUSY_PIN = 24
RST_PIN = 17
DC_PIN = 25
CS_PIN = 8
BUSY_PIN = 24
def __init__(self):
import ctypes
@ -151,13 +151,14 @@ class JetsonNano:
self.GPIO.cleanup([self.RST_PIN, self.DC_PIN, self.CS_PIN, self.BUSY_PIN])
class SunriseX3:
# Pin definition
RST_PIN = 17
DC_PIN = 25
CS_PIN = 8
BUSY_PIN = 24
Flag = 0
RST_PIN = 17
DC_PIN = 25
CS_PIN = 8
BUSY_PIN = 24
Flag = 0
def __init__(self):
import spidev
@ -184,7 +185,7 @@ class SunriseX3:
self.SPI.xfer3(data)
def module_init(self):
if self.Flag == 0 :
if self.Flag == 0:
self.Flag = 1
self.GPIO.setmode(self.GPIO.BCM)
self.GPIO.setwarnings(False)
@ -198,7 +199,7 @@ class SunriseX3:
self.SPI.max_speed_hz = 4000000
self.SPI.mode = 0b00
return 0
else :
else:
return 0
def module_exit(self):
@ -212,6 +213,7 @@ class SunriseX3:
self.GPIO.cleanup([self.RST_PIN, self.DC_PIN, self.CS_PIN, self.BUSY_PIN])
if os.path.exists('/sys/bus/platform/drivers/gpiomem-bcm2835'):
implementation = RaspberryPi()
elif os.path.exists('/sys/bus/platform/drivers/gpio-x3'):
@ -222,5 +224,4 @@ else:
for func in [x for x in dir(implementation) if not x.startswith('_')]:
setattr(sys.modules[__name__], func, getattr(implementation, func))
### END OF FILE ###