parameters: (f)
docstring: write SPI device table
docstring_summary: write SPI device table
docstring_tokens: write SPI device table
function: def write_QSPI_table(f):
      '''write SPI device table'''
      f.write('\n// QSPI device table\n')
      devlist = []
      for dev in qspidev:
          if len(dev) != 6:
              print("Badly formed QSPIDEV line %s" % dev)
          name = '"' + dev[0] + '"'
          bus = dev[1]
          mode = dev[2]
          speed = dev[3]
          size_pow2 = dev[4]
          ncs_clk_delay = dev[5]
          if not bus.startswith('QUADSPI') or bus not in qspi_list:
              error("Bad QUADSPI bus in QSPIDEV line %s" % dev)
          if mode not in ['MODE1', 'MODE3']:
              error("Bad MODE in QSPIDEV line %s" % dev)
          if not speed.endswith('*MHZ') and not speed.endswith('*KHZ'):
              error("Bad speed value %s in SPIDEV line %s" % (speed, dev))
  
          devidx = len(devlist)
          f.write(
              '#define HAL_QSPI_DEVICE%-2u QSPIDesc(%-17s, %2u, QSPIDEV_%s, %7s, %2u, %2u)\n'
              % (devidx, name, qspi_list.index(bus), mode, speed, int(size_pow2), int(ncs_clk_delay)))
          devlist.append('HAL_QSPI_DEVICE%u' % devidx)
      f.write('#define HAL_QSPI_DEVICE_LIST %s\n\n' % ','.join(devlist))
      for dev in qspidev:
          f.write("#define HAL_HAS_WSPI_%s 1\n" % dev[0].upper().replace("-", "_"))
          f.write("#define HAL_QSPI%d_CLK (%s)" % (int(bus[7:]), speed))
      f.write("\n")
function_tokens: def write_QSPI_table ( f ) : f . write ( '\n// QSPI device table\n' ) devlist = [ ] for dev in qspidev : if len ( dev ) != 6 : print ( "Badly formed QSPIDEV line %s" % dev ) name = '"' + dev [ 0 ] + '"' bus = dev [ 1 ] mode = dev [ 2 ] speed = dev [ 3 ] size_pow2 = dev [ 4 ] ncs_clk_delay = dev [ 5 ] if not bus . startswith ( 'QUADSPI' ) or bus not in qspi_list : error ( "Bad QUADSPI bus in QSPIDEV line %s" % dev ) if mode not in [ 'MODE1' , 'MODE3' ] : error ( "Bad MODE in QSPIDEV line %s" % dev ) if not speed . endswith ( '*MHZ' ) and not speed . endswith ( '*KHZ' ) : error ( "Bad speed value %s in SPIDEV line %s" % ( speed , dev ) ) devidx = len ( devlist ) f . write ( '#define HAL_QSPI_DEVICE%-2u QSPIDesc(%-17s, %2u, QSPIDEV_%s, %7s, %2u, %2u)\n' % ( devidx , name , qspi_list . index ( bus ) , mode , speed , int ( size_pow2 ) , int ( ncs_clk_delay ) ) ) devlist . append ( 'HAL_QSPI_DEVICE%u' % devidx ) f . write ( '#define HAL_QSPI_DEVICE_LIST %s\n\n' % ',' . join ( devlist ) ) for dev in qspidev : f . write ( "#define HAL_HAS_WSPI_%s 1\n" % dev [ 0 ] . upper ( ) . replace ( "-" , "_" ) ) f . write ( "#define HAL_QSPI%d_CLK (%s)" % ( int ( bus [ 7 : ] ) , speed ) ) f . write ( "\n" )