mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-12 01:08:00 -06:00
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 <kevin@koconnor.net>
This commit is contained in:
parent
7a9553b38a
commit
273a98d39a
13 changed files with 39 additions and 50 deletions
|
@ -8,9 +8,7 @@ class ad5206:
|
|||
def __init__(self, config):
|
||||
ppins = config.get_printer().lookup_object('pins')
|
||||
enable_pin = config.get('enable_pin')
|
||||
enable_pin_params = ppins.lookup_pin('digital_out', enable_pin)
|
||||
if enable_pin_params['invert']:
|
||||
raise ppins.error("ad5206 can not invert pin")
|
||||
enable_pin_params = ppins.lookup_pin(enable_pin)
|
||||
mcu = enable_pin_params['chip']
|
||||
pin = enable_pin_params['pin']
|
||||
scale = config.getfloat('scale', 1., above=0.)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue