mcu: Do not invert the direction of pullup pins by default

A pullup setting on an input pin (ie, '^') should enable the hardware
pullup resistor, but it should not invert the trigger level (ie, it
should remain trigger on high).  Those that need to change the trigger
level (ie, trigger on low) must now do that explicitly (ie, '^!').
This makes the code match what other firmwares do.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-11-08 09:29:38 -05:00
parent 3b5b895a10
commit 5e6127869a
3 changed files with 8 additions and 8 deletions

View file

@ -9,10 +9,10 @@ import serialhdl, pins, chelper
def parse_pin_extras(pin, can_pullup=False):
pullup = invert = 0
if can_pullup and pin.startswith('^'):
pullup = invert = 1
pullup = 1
pin = pin[1:].strip()
if pin.startswith('!'):
invert = invert ^ 1
invert = 1
pin = pin[1:].strip()
return pin, pullup, invert