Eagle SCH importer: fixed open-collector pin type, simplified pin direction matching

This commit is contained in:
Maciej Suminski 2018-04-03 13:16:29 +02:00
parent 6d06ed3579
commit 71bf488507
1 changed files with 20 additions and 38 deletions

View File

@ -1252,46 +1252,28 @@ bool SCH_EAGLE_PLUGIN::loadSymbol( wxXmlNode* aSymbolNode, std::unique_ptr<LIB_P
if( ePin.direction ) if( ePin.direction )
{ {
if( wxString( *ePin.direction ).Lower()== "sup" ) const std::map<wxString, ELECTRICAL_PINTYPE> pinDirectionsMap =
{ {
ispower = true; { "sup", PIN_POWER_IN }, { "pas", PIN_PASSIVE },
pin->SetType( PIN_POWER_IN ); { "out", PIN_OUTPUT }, { "in", PIN_INPUT },
} { "nc", PIN_NC }, { "io", PIN_BIDI },
else if( wxString( *ePin.direction ).Lower()== "pas" ) { "oc", PIN_OPENCOLLECTOR }, { "hiz", PIN_TRISTATE },
{ "pwr", PIN_POWER_IN },
};
pin->SetType( PIN_UNSPECIFIED );
for( const auto& pinDir : pinDirectionsMap )
{ {
pin->SetType( PIN_PASSIVE ); if( ePin.direction->Lower() == pinDir.first )
} {
else if( wxString( *ePin.direction ).Lower()== "out" ) pin->SetType( pinDir.second );
{
pin->SetType( PIN_OUTPUT ); if( pinDir.first == "sup" ) // power supply symbol
} ispower = true;
else if( wxString( *ePin.direction ).Lower()== "in" )
{ break;
pin->SetType( PIN_INPUT ); }
}
else if( wxString( *ePin.direction ).Lower()== "nc" )
{
pin->SetType( PIN_NC );
}
else if( wxString( *ePin.direction ).Lower()== "io" )
{
pin->SetType( PIN_BIDI );
}
else if( wxString( *ePin.direction ).Lower()== "oc" )
{
pin->SetType( PIN_OPENEMITTER );
}
else if( wxString( *ePin.direction ).Lower()== "hiz" )
{
pin->SetType( PIN_TRISTATE );
}
else if( wxString( *ePin.direction ).Lower()== "pwr" )
{
pin->SetType( PIN_POWER_IN );
}
else
{
pin->SetType( PIN_UNSPECIFIED );
} }
} }