#NEWLINE# def __init__( self , machine ) : #NEWLINE# #INDENT# super ( HardwarePlatform , self ) . __init__ ( machine ) #NEWLINE# self . log = logging . getLogger ( 'FAST' ) #NEWLINE# self . log . info ( 'Configuring FAST hardware.' ) #NEWLINE# if ( not serial_imported ) : #NEWLINE# #INDENT# self . log . error ( 'Could not import "pySerial". This is required for the FAST platform interface' ) #NEWLINE# sys . exit ( ) #NEWLINE# #UNINDENT# self . features [ 'max_pulse' ] = 255 #NEWLINE# self . features [ 'hw_timer' ] = False #NEWLINE# self . features [ 'hw_rule_coil_delay' ] = True #NEWLINE# self . features [ 'variable_recycle_time' ] = True #NEWLINE# self . features [ 'variable_debounce_time' ] = True #NEWLINE# self . machine . config [ 'platform' ] = self . features #NEWLINE# self . hw_rules = dict ( ) #NEWLINE# self . dmd_connection = None #NEWLINE# self . net_connection = None #NEWLINE# self . rgb_connection = None #NEWLINE# self . fast_nodes = list ( ) #NEWLINE# self . connection_threads = set ( ) #NEWLINE# self . receive_queue = Queue . Queue ( ) #NEWLINE# self . fast_leds = set ( ) #NEWLINE# self . flag_led_tick_registered = False #NEWLINE# self . fast_io_boards = list ( ) #NEWLINE# self . waiting_for_switch_data = False #NEWLINE# config_spec = '\n                    ports: list\n                    baud: int|921600\n                    config_number_format: string|hex\n                    watchdog: ms|1000\n                    default_debounce_open: ms|30\n                    default_debounce_close: ms|30\n                    debug: boolean|False\n                    ' #NEWLINE# self . config = Config . process_config ( config_spec = config_spec , source = self . machine . config [ 'fast' ] ) #NEWLINE# self . watchdog_command = ( 'WD:' + str ( hex ( self . config [ 'watchdog' ] ) ) [ 2 : ] ) #NEWLINE# self . machine_type = self . machine . config [ 'hardware' ] [ 'driverboards' ] . lower ( ) #NEWLINE# if ( self . machine_type == 'wpc' ) : #NEWLINE# #INDENT# self . log . info ( 'Configuring the FAST Controller for WPC driver board' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . log . info ( 'Configuring FAST Controller for FAST IO boards.' ) #NEWLINE# #UNINDENT# self . _connect_to_hardware ( ) #NEWLINE# if ( 'config_number_format' not in self . machine . config [ 'fast' ] ) : #NEWLINE# #INDENT# self . machine . config [ 'fast' ] [ 'config_number_format' ] = 'int' #NEWLINE# #UNINDENT# self . wpc_switch_map = { #NEWLINE# #INDENT# 'S11' : '00' , #NEWLINE# 'S12' : '01' , #NEWLINE# 'S13' : '02' , #NEWLINE# 'S14' : '03' , #NEWLINE# 'S15' : '04' , #NEWLINE# 'S16' : '05' , #NEWLINE# 'S17' : '06' , #NEWLINE# 'S18' : '07' , #NEWLINE# 'S21' : '08' , #NEWLINE# 'S22' : '09' , #NEWLINE# 'S23' : '0A' , #NEWLINE# 'S24' : '0B' , #NEWLINE# 'S25' : '0C' , #NEWLINE# 'S26' : '0D' , #NEWLINE# 'S27' : '0E' , #NEWLINE# 'S28' : '0F' , #NEWLINE# 'S31' : '10' , #NEWLINE# 'S32' : '11' , #NEWLINE# 'S33' : '12' , #NEWLINE# 'S34' : '13' , #NEWLINE# 'S35' : '14' , #NEWLINE# 'S36' : '15' , #NEWLINE# 'S37' : '16' , #NEWLINE# 'S38' : '17' , #NEWLINE# 'S41' : '18' , #NEWLINE# 'S42' : '19' , #NEWLINE# 'S43' : '1A' , #NEWLINE# 'S44' : '1B' , #NEWLINE# 'S45' : '1C' , #NEWLINE# 'S46' : '1D' , #NEWLINE# 'S47' : '1E' , #NEWLINE# 'S48' : '1F' , #NEWLINE# 'S51' : '20' , #NEWLINE# 'S52' : '21' , #NEWLINE# 'S53' : '22' , #NEWLINE# 'S54' : '23' , #NEWLINE# 'S55' : '24' , #NEWLINE# 'S56' : '25' , #NEWLINE# 'S57' : '26' , #NEWLINE# 'S58' : '27' , #NEWLINE# 'S61' : '28' , #NEWLINE# 'S62' : '29' , #NEWLINE# 'S63' : '2A' , #NEWLINE# 'S64' : '2B' , #NEWLINE# 'S65' : '2C' , #NEWLINE# 'S66' : '2D' , #NEWLINE# 'S67' : '2E' , #NEWLINE# 'S68' : '2F' , #NEWLINE# 'S71' : '30' , #NEWLINE# 'S72' : '31' , #NEWLINE# 'S73' : '32' , #NEWLINE# 'S74' : '33' , #NEWLINE# 'S75' : '34' , #NEWLINE# 'S76' : '35' , #NEWLINE# 'S77' : '36' , #NEWLINE# 'S78' : '37' , #NEWLINE# 'S81' : '38' , #NEWLINE# 'S82' : '39' , #NEWLINE# 'S83' : '3A' , #NEWLINE# 'S84' : '3B' , #NEWLINE# 'S85' : '3C' , #NEWLINE# 'S86' : '3D' , #NEWLINE# 'S87' : '3E' , #NEWLINE# 'S88' : '3F' , #NEWLINE# 'S91' : '40' , #NEWLINE# 'S92' : '41' , #NEWLINE# 'S93' : '42' , #NEWLINE# 'S94' : '43' , #NEWLINE# 'S95' : '44' , #NEWLINE# 'S96' : '45' , #NEWLINE# 'S97' : '46' , #NEWLINE# 'S98' : '47' , #NEWLINE# 'S101' : '48' , #NEWLINE# 'S102' : '49' , #NEWLINE# 'S103' : '4A' , #NEWLINE# 'S104' : '4B' , #NEWLINE# 'S105' : '4C' , #NEWLINE# 'S106' : '4D' , #NEWLINE# 'S107' : '4E' , #NEWLINE# 'S108' : '4F' , #NEWLINE# 'SD1' : '50' , #NEWLINE# 'SD2' : '51' , #NEWLINE# 'SD3' : '52' , #NEWLINE# 'SD4' : '53' , #NEWLINE# 'SD5' : '54' , #NEWLINE# 'SD6' : '55' , #NEWLINE# 'SD7' : '56' , #NEWLINE# 'SD8' : '57' , #NEWLINE# 'DIP1' : '58' , #NEWLINE# 'DIP2' : '59' , #NEWLINE# 'DIP3' : '5A' , #NEWLINE# 'DIP4' : '5B' , #NEWLINE# 'DIP5' : '5C' , #NEWLINE# 'DIP6' : '5D' , #NEWLINE# 'DIP7' : '5E' , #NEWLINE# 'DIP8' : '5F' , #NEWLINE# 'SF1' : '60' , #NEWLINE# 'SF2' : '61' , #NEWLINE# 'SF3' : '62' , #NEWLINE# 'SF4' : '63' , #NEWLINE# 'SF5' : '64' , #NEWLINE# 'SF6' : '65' , #NEWLINE# 'SF7' : '66' , #NEWLINE# 'SF8' : '67' , #NEWLINE# #UNINDENT# } #NEWLINE# self . wpc_light_map = { #NEWLINE# #INDENT# 'L11' : '00' , #NEWLINE# 'L12' : '01' , #NEWLINE# 'L13' : '02' , #NEWLINE# 'L14' : '03' , #NEWLINE# 'L15' : '04' , #NEWLINE# 'L16' : '05' , #NEWLINE# 'L17' : '06' , #NEWLINE# 'L18' : '07' , #NEWLINE# 'L21' : '08' , #NEWLINE# 'L22' : '09' , #NEWLINE# 'L23' : '0A' , #NEWLINE# 'L24' : '0B' , #NEWLINE# 'L25' : '0C' , #NEWLINE# 'L26' : '0D' , #NEWLINE# 'L27' : '0E' , #NEWLINE# 'L28' : '0F' , #NEWLINE# 'L31' : '10' , #NEWLINE# 'L32' : '11' , #NEWLINE# 'L33' : '12' , #NEWLINE# 'L34' : '13' , #NEWLINE# 'L35' : '14' , #NEWLINE# 'L36' : '15' , #NEWLINE# 'L37' : '16' , #NEWLINE# 'L38' : '17' , #NEWLINE# 'L41' : '18' , #NEWLINE# 'L42' : '19' , #NEWLINE# 'L43' : '1A' , #NEWLINE# 'L44' : '1B' , #NEWLINE# 'L45' : '1C' , #NEWLINE# 'L46' : '1D' , #NEWLINE# 'L47' : '1E' , #NEWLINE# 'L48' : '1F' , #NEWLINE# 'L51' : '20' , #NEWLINE# 'L52' : '21' , #NEWLINE# 'L53' : '22' , #NEWLINE# 'L54' : '23' , #NEWLINE# 'L55' : '24' , #NEWLINE# 'L56' : '25' , #NEWLINE# 'L57' : '26' , #NEWLINE# 'L58' : '27' , #NEWLINE# 'L61' : '28' , #NEWLINE# 'L62' : '29' , #NEWLINE# 'L63' : '2A' , #NEWLINE# 'L64' : '2B' , #NEWLINE# 'L65' : '2C' , #NEWLINE# 'L66' : '2D' , #NEWLINE# 'L67' : '2E' , #NEWLINE# 'L68' : '2F' , #NEWLINE# 'L71' : '30' , #NEWLINE# 'L72' : '31' , #NEWLINE# 'L73' : '32' , #NEWLINE# 'L74' : '33' , #NEWLINE# 'L75' : '34' , #NEWLINE# 'L76' : '35' , #NEWLINE# 'L77' : '36' , #NEWLINE# 'L78' : '37' , #NEWLINE# 'L81' : '38' , #NEWLINE# 'L82' : '39' , #NEWLINE# 'L83' : '3A' , #NEWLINE# 'L84' : '3B' , #NEWLINE# 'L85' : '3C' , #NEWLINE# 'L86' : '3D' , #NEWLINE# 'L87' : '3E' , #NEWLINE# 'L88' : '3F' , #NEWLINE# #UNINDENT# } #NEWLINE# self . wpc_driver_map = { #NEWLINE# #INDENT# 'C01' : '00' , #NEWLINE# 'C02' : '01' , #NEWLINE# 'C03' : '02' , #NEWLINE# 'C04' : '03' , #NEWLINE# 'C05' : '04' , #NEWLINE# 'C06' : '05' , #NEWLINE# 'C07' : '06' , #NEWLINE# 'C08' : '07' , #NEWLINE# 'C09' : '08' , #NEWLINE# 'C10' : '09' , #NEWLINE# 'C11' : '0A' , #NEWLINE# 'C12' : '0B' , #NEWLINE# 'C13' : '0C' , #NEWLINE# 'C14' : '0D' , #NEWLINE# 'C15' : '0E' , #NEWLINE# 'C16' : '0F' , #NEWLINE# 'C17' : '10' , #NEWLINE# 'C18' : '11' , #NEWLINE# 'C19' : '12' , #NEWLINE# 'C20' : '13' , #NEWLINE# 'C21' : '14' , #NEWLINE# 'C22' : '15' , #NEWLINE# 'C23' : '16' , #NEWLINE# 'C24' : '17' , #NEWLINE# 'C25' : '18' , #NEWLINE# 'C26' : '19' , #NEWLINE# 'C27' : '1A' , #NEWLINE# 'C28' : '1B' , #NEWLINE# 'C29' : '1C' , #NEWLINE# 'C30' : '1D' , #NEWLINE# 'C31' : '1E' , #NEWLINE# 'C32' : '1F' , #NEWLINE# 'C33' : '24' , #NEWLINE# 'C34' : '25' , #NEWLINE# 'C35' : '26' , #NEWLINE# 'C36' : '27' , #NEWLINE# 'FLRM' : '20' , #NEWLINE# 'FLRH' : '21' , #NEWLINE# 'FLLM' : '22' , #NEWLINE# 'FLLH' : '23' , #NEWLINE# 'FURM' : '24' , #NEWLINE# 'FURH' : '25' , #NEWLINE# 'FULM' : '26' , #NEWLINE# 'FULH' : '27' , #NEWLINE# 'C37' : '28' , #NEWLINE# 'C38' : '29' , #NEWLINE# 'C39' : '2A' , #NEWLINE# 'C40' : '2B' , #NEWLINE# 'C41' : '2C' , #NEWLINE# 'C42' : '2D' , #NEWLINE# 'C43' : '2E' , #NEWLINE# 'C44' : '2F' , #NEWLINE# #UNINDENT# } #NEWLINE# self . wpc_gi_map = { #NEWLINE# #INDENT# 'G01' : '00' , #NEWLINE# 'G02' : '01' , #NEWLINE# 'G03' : '02' , #NEWLINE# 'G04' : '03' , #NEWLINE# 'G05' : '04' , #NEWLINE# 'G06' : '05' , #NEWLINE# 'G07' : '06' , #NEWLINE# 'G08' : '07' , #NEWLINE# #UNINDENT# } #NEWLINE# self . fast_commands = { #NEWLINE# #INDENT# 'ID' : self . receive_id , #NEWLINE# 'WX' : self . receive_wx , #NEWLINE# 'NI' : self . receive_ni , #NEWLINE# 'RX' : self . receive_rx , #NEWLINE# 'DX' : self . receive_dx , #NEWLINE# 'SX' : self . receive_sx , #NEWLINE# 'LX' : self . receive_lx , #NEWLINE# 'PX' : self . receive_px , #NEWLINE# 'SA' : self . receive_sa , #NEWLINE# '/N' : self . receive_nw_open , #NEWLINE# '-N' : self . receive_nw_closed , #NEWLINE# '/L' : self . receive_local_open , #NEWLINE# '-L' : self . receive_local_closed , #NEWLINE# 'WD' : self . receive_wd , #NEWLINE# #UNINDENT# }