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),
|
spi_args['select_pin'] in (7, 8),
|
||||||
)):
|
)):
|
||||||
try:
|
try:
|
||||||
hardware_spi_args = {
|
return self.spi_classes[('hardware', shared)](
|
||||||
'port': 0,
|
self, port=0, device=0 if spi_args['select_pin'] == 8 else 1
|
||||||
'device': {8: 0, 7: 1}[spi_args['select_pin']],
|
)
|
||||||
}
|
|
||||||
return self.spi_classes[('hardware', shared)](self, **hardware_spi_args)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
warnings.warn(
|
warnings.warn(
|
||||||
SPISoftwareFallback(
|
SPISoftwareFallback(
|
||||||
|
|||||||
Reference in New Issue
Block a user