From 273a98d39a88a372c8a2c816622e7df1f777e77d Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Thu, 26 Jul 2018 09:44:45 -0400 Subject: pins: Explicitly pass can_invert and can_pullup to lookup_pin() Don't pass pin_type to lookup_pin() - instead, if a pin can be inverted or can have a pullup, then the caller must explicitly specify that when calling lookup_pin(). This simplifies the code for the cases where it is not valid to invert or pullup. Explicitly pass the pin_type to setup_pin() and have ppins.setup_pin() apply default pullup and invert flags. Signed-off-by: Kevin O'Connor --- klippy/mcu.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'klippy/mcu.py') diff --git a/klippy/mcu.py b/klippy/mcu.py index a25fc3f7..3618e6a7 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -610,10 +610,9 @@ class MCU: self.register_msg(self._handle_mcu_stats, 'stats') self._check_config() # Config creation helpers - def setup_pin(self, pin_params): + def setup_pin(self, pin_type, pin_params): pcs = {'stepper': MCU_stepper, 'endstop': MCU_endstop, 'digital_out': MCU_digital_out, 'pwm': MCU_pwm, 'adc': MCU_adc} - pin_type = pin_params['type'] if pin_type not in pcs: raise pins.error("pin type %s not supported on mcu" % (pin_type,)) co = pcs[pin_type](self, pin_params) -- cgit v1.2.3-70-g09d2