mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Inline the SPI hardware args (neater code)
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user