diff --git a/api/src/opentrons/drivers/rpi_drivers/gpio.py b/api/src/opentrons/drivers/rpi_drivers/gpio.py index 5f7d562e23f..d343c485751 100755 --- a/api/src/opentrons/drivers/rpi_drivers/gpio.py +++ b/api/src/opentrons/drivers/rpi_drivers/gpio.py @@ -132,6 +132,18 @@ async def setup(self): self.set_reset_pin(True) await asyncio.sleep(0.25) + def setup_v1(self): + # TODO: AA 07-08-2020 remove when legacy API is deprecated + MODULE_LOG.info("Setting up GPIOs for APIv1") + self.set_audio_enable(True) + # smoothieware programming pins, must be in a known state (HIGH) + self.set_halt_pin(True) + self.set_isp_pin(True) + self.set_reset_pin(False) + time.sleep(0.25) + self.set_reset_pin(True) + time.sleep(0.25) + def set_high(self, output_pin: GPIOPin): self.lines[output_pin.name].set_value(1) diff --git a/api/src/opentrons/legacy_api/robot/robot.py b/api/src/opentrons/legacy_api/robot/robot.py index ba4f3404455..bf7eafed174 100755 --- a/api/src/opentrons/legacy_api/robot/robot.py +++ b/api/src/opentrons/legacy_api/robot/robot.py @@ -14,6 +14,8 @@ from opentrons.data_storage import database, old_container_loading,\ database_migration +from opentrons.drivers.rpi_drivers import build_gpio_chardev +from opentrons.drivers.rpi_drivers.gpio_simulator import SimulatingGPIOCharDev from opentrons.drivers.smoothie_drivers import driver_3_0 from opentrons.drivers.types import MoveSplit from opentrons.trackers import pose_tracker @@ -530,7 +532,17 @@ def connect(self, port=None, options=None): >>> from opentrons import robot # doctest: +SKIP >>> robot.connect() # doctest: +SKIP """ - + log.info( + 'Setting up GPIOs for APIv1, expected to fail if opentrons-' + 'robot-server is already running. This should not affect the ' + 'robot lights behavior in the protocol if it is running using ' + 'the Opentrons App.') + gpio_chardev = build_gpio_chardev('gpiochip0') + # setup gpio chardev if built successfully + if not isinstance(gpio_chardev, SimulatingGPIOCharDev): + gpio_chardev.config_by_board_rev() + gpio_chardev.setup_v1() + self._driver.gpio_chardev = gpio_chardev self._driver.connect(port=port) self.fw_version = self._driver.get_fw_version()