From ffcc67a3b704271192851ec27517053b41a6aabd Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Wed, 7 Feb 2024 12:54:58 +0000 Subject: [PATCH] All: Revert to using line numbers. Avoid calling gpiodevice's platform detect on import time. --- inky/inky.py | 12 +++--------- inky/inky_ac073tc1a.py | 12 +++--------- inky/inky_ssd1608.py | 12 +++--------- inky/inky_ssd1683.py | 12 +++--------- inky/inky_uc8159.py | 12 +++--------- 5 files changed, 15 insertions(+), 45 deletions(-) diff --git a/inky/inky.py b/inky/inky.py index b333dcf..4f2575a 100644 --- a/inky/inky.py +++ b/inky/inky.py @@ -8,7 +8,6 @@ import gpiodevice import numpy from gpiod.line import Bias, Direction, Edge, Value -from gpiodevice import platform from PIL import Image from . import eeprom @@ -20,14 +19,9 @@ BLACK = 1 RED = YELLOW = 2 -if platform.get_name().startswith("Raspberry Pi 5"): - RESET_PIN = "PIN13" # GPIO 27 - BUSY_PIN = "PIN11" # GPIO 17 - DC_PIN = "PIN15" # GPIO 22 -else: - RESET_PIN = "GPIO27" - BUSY_PIN = "GPIO17" - DC_PIN = "GPIO22" +RESET_PIN = 27 # PIN13 +BUSY_PIN = 17 # PIN11 +DC_PIN = 22 # PIN15 # In addition the following pins are used for SPI MOSI_PIN = 10 diff --git a/inky/inky_ac073tc1a.py b/inky/inky_ac073tc1a.py index c29054f..c6625f1 100644 --- a/inky/inky_ac073tc1a.py +++ b/inky/inky_ac073tc1a.py @@ -6,7 +6,6 @@ import gpiod import gpiodevice from gpiod.line import Direction, Edge, Value -from gpiodevice import platform from PIL import Image from . import eeprom @@ -25,14 +24,9 @@ ORANGE = 6 CLEAN = 7 -if platform.get_name().startswith("Raspberry Pi 5"): - RESET_PIN = "PIN13" # GPIO 27 - BUSY_PIN = "PIN11" # GPIO 17 - DC_PIN = "PIN15" # GPIO 22 -else: - RESET_PIN = "GPIO27" - BUSY_PIN = "GPIO17" - DC_PIN = "GPIO22" +RESET_PIN = 27 # PIN13 +BUSY_PIN = 17 # PIN11 +DC_PIN = 22 # PIN15 MOSI_PIN = 10 SCLK_PIN = 11 diff --git a/inky/inky_ssd1608.py b/inky/inky_ssd1608.py index 1698313..a5474c0 100644 --- a/inky/inky_ssd1608.py +++ b/inky/inky_ssd1608.py @@ -7,7 +7,6 @@ import gpiodevice import numpy from gpiod.line import Bias, Direction, Edge, Value -from gpiodevice import platform from PIL import Image from . import eeprom, ssd1608 @@ -16,14 +15,9 @@ BLACK = 1 RED = YELLOW = 2 -if platform.get_name().startswith("Raspberry Pi 5"): - RESET_PIN = "PIN13" # GPIO 27 - BUSY_PIN = "PIN11" # GPIO 17 - DC_PIN = "PIN15" # GPIO 22 -else: - RESET_PIN = "GPIO27" - BUSY_PIN = "GPIO17" - DC_PIN = "GPIO22" +RESET_PIN = 27 # PIN13 +BUSY_PIN = 17 # PIN11 +DC_PIN = 22 # PIN15 MOSI_PIN = 10 SCLK_PIN = 11 diff --git a/inky/inky_ssd1683.py b/inky/inky_ssd1683.py index 05321d3..66e39f3 100644 --- a/inky/inky_ssd1683.py +++ b/inky/inky_ssd1683.py @@ -6,7 +6,6 @@ import gpiodevice import numpy from gpiod.line import Bias, Direction, Edge, Value -from gpiodevice import platform from PIL import Image from . import eeprom, ssd1683 @@ -15,14 +14,9 @@ BLACK = 1 RED = YELLOW = 2 -if platform.get_name().startswith("Raspberry Pi 5"): - RESET_PIN = "PIN13" # GPIO 27 - BUSY_PIN = "PIN11" # GPIO 17 - DC_PIN = "PIN15" # GPIO 22 -else: - RESET_PIN = "GPIO27" - BUSY_PIN = "GPIO17" - DC_PIN = "GPIO22" +RESET_PIN = 27 # PIN13 +BUSY_PIN = 17 # PIN11 +DC_PIN = 22 # PIN15 MOSI_PIN = 10 SCLK_PIN = 11 diff --git a/inky/inky_uc8159.py b/inky/inky_uc8159.py index aac6008..1b0da80 100644 --- a/inky/inky_uc8159.py +++ b/inky/inky_uc8159.py @@ -8,7 +8,6 @@ import gpiodevice import numpy from gpiod.line import Bias, Direction, Edge, Value -from gpiodevice import platform from PIL import Image from . import eeprom @@ -44,14 +43,9 @@ [255, 255, 255] ] -if platform.get_name().startswith("Raspberry Pi 5"): - RESET_PIN = "PIN13" # GPIO 27 - BUSY_PIN = "PIN11" # GPIO 17 - DC_PIN = "PIN15" # GPIO 22 -else: - RESET_PIN = "GPIO27" - BUSY_PIN = "GPIO17" - DC_PIN = "GPIO22" +RESET_PIN = 27 # PIN13 +BUSY_PIN = 17 # PIN11 +DC_PIN = 22 # PIN15 MOSI_PIN = 10 SCLK_PIN = 11