parameters: ()
return_statement: return peripherals
docstring: build a list of peripherals for DMA resolver to work on
docstring_summary: build a list of peripherals for DMA resolver to work on
docstring_tokens: build a list of peripherals for DMA resolver to work on
function: def build_peripheral_list():
      '''build a list of peripherals for DMA resolver to work on'''
      peripherals = []
      done = set()
      prefixes = ['SPI', 'USART', 'UART', 'I2C']
      periph_pins = allpins[:]
      for alt in altmap.keys():
          for p in altmap[alt].keys():
              periph_pins.append(altmap[alt][p])
      for p in periph_pins:
          type = p.type
          if type.startswith('TIM'):
              # we need to independently demand DMA for each channel
              type = p.label
          if type in done:
              continue
          for prefix in prefixes:
              if type.startswith(prefix):
                  ptx = type + "_TX"
                  prx = type + "_RX"
                  if prefix in ['SPI', 'I2C']:
                      # in DMA map I2C and SPI has RX and TX suffix
                      if ptx not in bylabel:
                          bylabel[ptx] = p
                      if prx not in bylabel:
                          bylabel[prx] = p
                  if prx in bylabel or prx in altlabel:
                      peripherals.append(prx)
                  if ptx in bylabel or ptx in altlabel:
                      peripherals.append(ptx)
  
          if type.startswith('ADC'):
              peripherals.append(type)
          if type.startswith('SDIO') or type.startswith('SDMMC'):
              if not mcu_series.startswith("STM32H7"):
                  peripherals.append(type)
          if type.startswith('TIM'):
              if p.has_extra('RCIN'):
                  label = p.label
                  if label[-1] == 'N':
                      label = label[:-1]
                  peripherals.append(label)
                  # RCIN DMA channel cannot be shared as it is running all the time
                  dma_noshare.append(label)
              elif not p.has_extra('ALARM') and not p.has_extra('RCININT'):
                  # get the TIMn_UP DMA channels for DShot
                  label = p.type + '_UP'
                  if label not in peripherals and not p.has_extra('NODMA'):
                      peripherals.append(label)
                  ch_label = type
                  (_, _, compl) = parse_timer(ch_label)
                  if ch_label not in peripherals and p.has_extra('BIDIR') and not compl:
                      peripherals.append(ch_label)
          done.add(type)
      return peripherals
function_tokens: def build_peripheral_list ( ) : peripherals = [ ] done = set ( ) prefixes = [ 'SPI' , 'USART' , 'UART' , 'I2C' ] periph_pins = allpins [ : ] for alt in altmap . keys ( ) : for p in altmap [ alt ] . keys ( ) : periph_pins . append ( altmap [ alt ] [ p ] ) for p in periph_pins : type = p . type if type . startswith ( 'TIM' ) : # we need to independently demand DMA for each channel type = p . label if type in done : continue for prefix in prefixes : if type . startswith ( prefix ) : ptx = type + "_TX" prx = type + "_RX" if prefix in [ 'SPI' , 'I2C' ] : # in DMA map I2C and SPI has RX and TX suffix if ptx not in bylabel : bylabel [ ptx ] = p if prx not in bylabel : bylabel [ prx ] = p if prx in bylabel or prx in altlabel : peripherals . append ( prx ) if ptx in bylabel or ptx in altlabel : peripherals . append ( ptx ) if type . startswith ( 'ADC' ) : peripherals . append ( type ) if type . startswith ( 'SDIO' ) or type . startswith ( 'SDMMC' ) : if not mcu_series . startswith ( "STM32H7" ) : peripherals . append ( type ) if type . startswith ( 'TIM' ) : if p . has_extra ( 'RCIN' ) : label = p . label if label [ - 1 ] == 'N' : label = label [ : - 1 ] peripherals . append ( label ) # RCIN DMA channel cannot be shared as it is running all the time dma_noshare . append ( label ) elif not p . has_extra ( 'ALARM' ) and not p . has_extra ( 'RCININT' ) : # get the TIMn_UP DMA channels for DShot label = p . type + '_UP' if label not in peripherals and not p . has_extra ( 'NODMA' ) : peripherals . append ( label ) ch_label = type ( _ , _ , compl ) = parse_timer ( ch_label ) if ch_label not in peripherals and p . has_extra ( 'BIDIR' ) and not compl : peripherals . append ( ch_label ) done . add ( type ) return peripherals