From de0d3baadba045708172d2cde83781b02a813137 Mon Sep 17 00:00:00 2001 From: Andrew Malota <2bitoperations@gmail.com> Date: Fri, 1 Dec 2017 18:59:07 -0600 Subject: [PATCH] add a note about GPIO collisions with system SPI --- config.py.EXAMPLE | 2 +- lib/oven.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config.py.EXAMPLE b/config.py.EXAMPLE index 19e9b0f..f002627 100644 --- a/config.py.EXAMPLE +++ b/config.py.EXAMPLE @@ -41,7 +41,7 @@ gpio_door = 18 # max6675 - bitbang SPI interface max31855 = 1 max6675 = 0 -max31855spi = 0 +max31855spi = 0 # if you use this one, you MUST reassign the default GPIO pins ### Thermocouple Connection (using bitbang interfaces) gpio_sensor_cs = 27 diff --git a/lib/oven.py b/lib/oven.py index 23e4582..fadd42d 100644 --- a/lib/oven.py +++ b/lib/oven.py @@ -20,6 +20,15 @@ try: import Adafruit_GPIO.SPI as SPI from max31855spi import MAX31855SPI, MAX31855SPIError log.info("import MAX31855SPI") + spi_reserved_gpio = [7, 8, 9, 10, 11] + if config.gpio_air in spi_reserved_gpio: + raise Exception("gpio_air pin %s collides with SPI pins %s" % (config.gpio_air, spi_reserved_gpio)) + if config.gpio_cool in spi_reserved_gpio: + raise Exception("gpio_cool pin %s collides with SPI pins %s" % (config.gpio_cool, spi_reserved_gpio)) + if config.gpio_door in spi_reserved_gpio: + raise Exception("gpio_door pin %s collides with SPI pins %s" % (config.gpio_door, spi_reserved_gpio)) + if config.gpio_heat in spi_reserved_gpio: + raise Exception("gpio_heat pin %s collides with SPI pins %s" % (config.gpio_heat, spi_reserved_gpio)) if config.max6675: from max6675 import MAX6675, MAX6675Error log.info("import MAX6675")