bus: Don't raise a "duplicate pin" warning on None pins

If "None" is used for an spi cs pin, then it should not reserve "None"
for other uses.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2018-12-30 18:12:07 -05:00
parent 68ebde0d86
commit 1be24b8fc7
2 changed files with 4 additions and 0 deletions

View File

@ -62,6 +62,7 @@ def MCU_SPI_from_config(config, mode, pin_option="cs_pin",
cs_pin_params = ppins.lookup_pin(cs_pin) cs_pin_params = ppins.lookup_pin(cs_pin)
pin = cs_pin_params['pin'] pin = cs_pin_params['pin']
if pin == 'None': if pin == 'None':
ppins.reset_pin_sharing(cs_pin_params)
pin = None pin = None
# Load bus parameters # Load bus parameters
speed = config.getint('spi_speed', default_speed, minval=100000) speed = config.getint('spi_speed', default_speed, minval=100000)

View File

@ -252,6 +252,9 @@ class PrinterPins:
can_pullup = pin_type in ['endstop'] can_pullup = pin_type in ['endstop']
pin_params = self.lookup_pin(pin_desc, can_invert, can_pullup) pin_params = self.lookup_pin(pin_desc, can_invert, can_pullup)
return pin_params['chip'].setup_pin(pin_type, pin_params) return pin_params['chip'].setup_pin(pin_type, pin_params)
def reset_pin_sharing(self, pin_params):
share_name = "%s:%s" % (pin_params['chip_name'], pin_params['pin'])
del self.active_pins[share_name]
def register_chip(self, chip_name, chip): def register_chip(self, chip_name, chip):
chip_name = chip_name.strip() chip_name = chip_name.strip()
if chip_name in self.chips: if chip_name in self.chips: