mcu: Drop support for TICKS() expansion in mcu config commands

It's no longer necessary to use the TICKS() hack as the config
commands are now all generated after the mcu speed is known.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-08-25 23:21:55 -04:00
parent 80dc1dfcc1
commit 68ba3d5106
2 changed files with 13 additions and 15 deletions

View file

@ -159,15 +159,12 @@ def get_pin_map(mcu, mapping_name=None):
update_map_beaglebone(pins, mcu)
return pins
# Translate pin names and tick times in a firmware command
# Translate pin names in a firmware command
re_pin = re.compile(r'(?P<prefix>[ _]pin=)(?P<name>[^ ]*)')
re_ticks = re.compile(r'TICKS\((?P<ticks>[^)]*)\)')
def update_command(cmd, mcu_freq, pmap):
def pin_fixup(m):
return m.group('prefix') + str(pmap[m.group('name')])
def ticks_fixup(m):
return str(int(mcu_freq * float(m.group('ticks'))))
return re_ticks.sub(ticks_fixup, re_pin.sub(pin_fixup, cmd))
return re_pin.sub(pin_fixup, cmd)
######################################################################