From 08076e8d0edfd11fe7e77f5c41552630060b9827 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Fri, 21 Oct 2016 22:30:47 +0100 Subject: [PATCH] Inline the SPI hardware args (neater code) --- gpiozero/pins/pi.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gpiozero/pins/pi.py b/gpiozero/pins/pi.py index 0d40efb..d663b08 100644 --- a/gpiozero/pins/pi.py +++ b/gpiozero/pins/pi.py @@ -106,11 +106,9 @@ class PiFactory(Factory): spi_args['select_pin'] in (7, 8), )): try: - hardware_spi_args = { - 'port': 0, - 'device': {8: 0, 7: 1}[spi_args['select_pin']], - } - return self.spi_classes[('hardware', shared)](self, **hardware_spi_args) + return self.spi_classes[('hardware', shared)]( + self, port=0, device=0 if spi_args['select_pin'] == 8 else 1 + ) except Exception as e: warnings.warn( SPISoftwareFallback(