Merge pull request #127 from GrantM11235/dont-rename-dma-ch

Don't rename DMA channels if they don't start at zero
This commit is contained in:
Dario Nieuwenhuis 2022-03-08 23:27:33 +01:00 committed by GitHub
commit cf354c22e1

View File

@ -1077,15 +1077,12 @@ def parse_dma():
if result := re.match('.*' + n + '_(Channel|Stream)\[(\d+)-(\d+)\]', channels[0]['@Name']): if result := re.match('.*' + n + '_(Channel|Stream)\[(\d+)-(\d+)\]', channels[0]['@Name']):
low = int(result.group(2)) low = int(result.group(2))
high = int(result.group(3)) high = int(result.group(3))
# Make sure all channels numbers start at 0
if low == 1:
low -= 1
high -= 1
for i in range(low, high + 1): for i in range(low, high + 1):
chip_dma['channels'].append({ chip_dma['channels'].append({
'name': n + '_CH' + str(i), 'name': n + '_CH' + str(i),
'dma': n, 'dma': n,
'channel': i, # Make sure all channels numbers start at 0
'channel': i - low,
'dmamux': dmamux, 'dmamux': dmamux,
'dmamux_channel': dmamux_channel, 'dmamux_channel': dmamux_channel,
}) })