Inline the SPI hardware args (neater code)

This commit is contained in:
Dave Jones
2016-10-21 22:30:47 +01:00
parent 15d2c860d3
commit 08076e8d0e

View File

@@ -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(