KiCad PCB EDA Suite
pin_type.h File Reference
#include <wx/arrstr.h>
#include <vector>

Go to the source code of this file.

Macros

#define ELECTRICAL_PINTYPES_TOTAL   ( static_cast<int>( ELECTRICAL_PINTYPE::PT_LAST_OPTION ) + 1 )
 
#define GRAPHIC_PINSHAPES_TOTAL   ( static_cast<int>( GRAPHIC_PINSHAPE::LAST_OPTION ) + 1 )
 

Enumerations

enum  ELECTRICAL_PINTYPE {
  ELECTRICAL_PINTYPE::PT_INPUT, ELECTRICAL_PINTYPE::PT_OUTPUT, ELECTRICAL_PINTYPE::PT_BIDI, ELECTRICAL_PINTYPE::PT_TRISTATE,
  ELECTRICAL_PINTYPE::PT_PASSIVE, ELECTRICAL_PINTYPE::PT_NIC, ELECTRICAL_PINTYPE::PT_UNSPECIFIED, ELECTRICAL_PINTYPE::PT_POWER_IN,
  ELECTRICAL_PINTYPE::PT_POWER_OUT, ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR, ELECTRICAL_PINTYPE::PT_OPENEMITTER, ELECTRICAL_PINTYPE::PT_NC,
  ELECTRICAL_PINTYPE::PT_LAST_OPTION = PT_NC
}
 The component library pin object electrical types used in ERC tests. More...
 
enum  GRAPHIC_PINSHAPE {
  GRAPHIC_PINSHAPE::LINE, GRAPHIC_PINSHAPE::INVERTED, GRAPHIC_PINSHAPE::CLOCK, GRAPHIC_PINSHAPE::INVERTED_CLOCK,
  GRAPHIC_PINSHAPE::INPUT_LOW, GRAPHIC_PINSHAPE::CLOCK_LOW, GRAPHIC_PINSHAPE::OUTPUT_LOW, GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK,
  GRAPHIC_PINSHAPE::NONLOGIC, GRAPHIC_PINSHAPE::LAST_OPTION = NONLOGIC
}
 

Functions

wxString PinShapeGetText (GRAPHIC_PINSHAPE shape)
 
BITMAPS PinShapeGetBitmap (GRAPHIC_PINSHAPE shape)
 
wxString ElectricalPinTypeGetText (ELECTRICAL_PINTYPE)
 
BITMAPS ElectricalPinTypeGetBitmap (ELECTRICAL_PINTYPE)
 
wxString PinOrientationName (unsigned aPinOrientationCode)
 
int PinOrientationCode (int index)
 
int PinOrientationIndex (int code)
 
const wxArrayString & PinTypeNames ()
 
const std::vector< BITMAPS > & PinTypeIcons ()
 
const wxArrayString & PinShapeNames ()
 
const std::vector< BITMAPS > & PinShapeIcons ()
 
const wxArrayString & PinOrientationNames ()
 
const std::vector< BITMAPS > & PinOrientationIcons ()
 

Macro Definition Documentation

◆ ELECTRICAL_PINTYPES_TOTAL

#define ELECTRICAL_PINTYPES_TOTAL   ( static_cast<int>( ELECTRICAL_PINTYPE::PT_LAST_OPTION ) + 1 )

Definition at line 53 of file pin_type.h.

◆ GRAPHIC_PINSHAPES_TOTAL

#define GRAPHIC_PINSHAPES_TOTAL   ( static_cast<int>( GRAPHIC_PINSHAPE::LAST_OPTION ) + 1 )

Definition at line 70 of file pin_type.h.

Enumeration Type Documentation

◆ ELECTRICAL_PINTYPE

enum ELECTRICAL_PINTYPE
strong

The component library pin object electrical types used in ERC tests.

Enumerator
PT_INPUT 

usual pin input: must be connected

PT_OUTPUT 

usual output

PT_BIDI 

input or output (like port for a microprocessor)

PT_TRISTATE 

tris state bus pin

PT_PASSIVE 

pin for passive components: must be connected, and can be connected to any pin

PT_NIC 

not internally connected (may be connected to anything)

PT_UNSPECIFIED 

unknown electrical properties: creates always a warning when connected

PT_POWER_IN 

power input (GND, VCC for ICs). Must be connected to a power output.

PT_POWER_OUT 

output of a regulator: intended to be connected to power input pins

PT_OPENCOLLECTOR 

pin type open collector

PT_OPENEMITTER 

pin type open emitter

PT_NC 

not connected (must be left open)

PT_LAST_OPTION 

sentinel value, set to last usable enum option

Definition at line 35 of file pin_type.h.

36 {
37  PT_INPUT,
38  PT_OUTPUT,
39  PT_BIDI,
40  PT_TRISTATE,
41  PT_PASSIVE,
42  PT_NIC,
44  PT_POWER_IN,
45  PT_POWER_OUT,
48  PT_NC,
49 
51 };
power input (GND, VCC for ICs). Must be connected to a power output.
pin for passive components: must be connected, and can be connected to any pin
unknown electrical properties: creates always a warning when connected
not internally connected (may be connected to anything)
sentinel value, set to last usable enum option
usual pin input: must be connected
input or output (like port for a microprocessor)
not connected (must be left open)
output of a regulator: intended to be connected to power input pins

◆ GRAPHIC_PINSHAPE

enum GRAPHIC_PINSHAPE
strong
Enumerator
LINE 
INVERTED 
CLOCK 
INVERTED_CLOCK 
INPUT_LOW 
CLOCK_LOW 
OUTPUT_LOW 
FALLING_EDGE_CLOCK 
NONLOGIC 
LAST_OPTION 

this is the sentinel value, must be set to last enum value

Definition at line 55 of file pin_type.h.

Function Documentation

◆ ElectricalPinTypeGetBitmap()

BITMAPS ElectricalPinTypeGetBitmap ( ELECTRICAL_PINTYPE  )

Definition at line 246 of file pin_type.cpp.

247 {
248  auto findIt = pinTypes.find( aType );
249 
250  wxCHECK_MSG( findIt != pinTypes.end(), BITMAPS::INVALID_BITMAP,
251  "Could not find pin type in lookup map" );
252 
253  return findIt->second.bitmap;
254 }
const std::map< ELECTRICAL_PINTYPE, struct pinTypeStruct > pinTypes
Definition: pin_type.cpp:49

References INVALID_BITMAP, and pinTypes.

Referenced by LIB_PIN::GetMenuImage(), InitTables(), and PinTypeComboBox::PinTypeComboBox().

◆ ElectricalPinTypeGetText()

wxString ElectricalPinTypeGetText ( ELECTRICAL_PINTYPE  )

Definition at line 236 of file pin_type.cpp.

237 {
238  auto findIt = pinTypes.find( aType );
239 
240  wxCHECK_MSG( findIt != pinTypes.end(), wxT( "???" ), "Could not find pin type in lookup map" );
241 
242  return findIt->second.name;
243 }
const std::map< ELECTRICAL_PINTYPE, struct pinTypeStruct > pinTypes
Definition: pin_type.cpp:49

References pinTypes.

Referenced by LIB_PIN::GetElectricalTypeName(), SCH_PIN::GetMsgPanelInfo(), LIB_PIN::GetMsgPanelInfo(), InitTables(), PinTypeComboBox::PinTypeComboBox(), and ERC_TESTER::TestPinToPin().

◆ PinOrientationCode()

int PinOrientationCode ( int  index)

Definition at line 137 of file pin_type.cpp.

138 {
139  if( index >= 0 && index < (int) PIN_ORIENTATION_CNT )
140  return pin_orientation_codes[ index ];
141 
142  return PIN_RIGHT;
143 }
#define PIN_ORIENTATION_CNT
Definition: pin_type.cpp:108
static const int pin_orientation_codes[]
Definition: pin_type.cpp:88

References PIN_ORIENTATION_CNT, pin_orientation_codes, and PIN_RIGHT.

Referenced by DIALOG_PIN_PROPERTIES::OnPropertiesChange(), PIN_TABLE_DATA_MODEL::SetValue(), and DIALOG_PIN_PROPERTIES::TransferDataFromWindow().

◆ PinOrientationIcons()

const std::vector<BITMAPS>& PinOrientationIcons ( )

Definition at line 227 of file pin_type.cpp.

228 {
229  if( g_orientationIcons.empty() )
230  InitTables();
231 
232  return g_orientationIcons;
233 }
void InitTables()
Definition: pin_type.cpp:160
static std::vector< BITMAPS > g_orientationIcons
Definition: pin_type.cpp:38

References g_orientationIcons, and InitTables().

Referenced by DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), and DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES().

◆ PinOrientationIndex()

int PinOrientationIndex ( int  code)

Definition at line 146 of file pin_type.cpp.

147 {
148  size_t i;
149 
150  for( i = 0; i < PIN_ORIENTATION_CNT; i++ )
151  {
152  if( pin_orientation_codes[i] == code )
153  return (int) i;
154  }
155 
156  return wxNOT_FOUND;
157 }
#define PIN_ORIENTATION_CNT
Definition: pin_type.cpp:108
static const int pin_orientation_codes[]
Definition: pin_type.cpp:88

References PIN_ORIENTATION_CNT, and pin_orientation_codes.

Referenced by SCH_PIN::GetMsgPanelInfo(), LIB_PIN::GetMsgPanelInfo(), PIN_TABLE_DATA_MODEL::GetValue(), and DIALOG_PIN_PROPERTIES::TransferDataToWindow().

◆ PinOrientationName()

wxString PinOrientationName ( unsigned  aPinOrientationCode)

Definition at line 115 of file pin_type.cpp.

116 {
117  /* Note: The following name lists are sentence capitalized per the GNOME UI
118  * standards for list controls. Please do not change the capitalization
119  * of these strings unless the GNOME UI standards are changed.
120  */
121  const wxString pin_orientation_names[] =
122  {
123  _( "Right" ),
124  _( "Left" ),
125  _( "Up" ),
126  _( "Down" ),
127  wxT( "???" )
128  };
129 
130  if( aPinOrientationCode > PIN_ORIENTATION_CNT )
131  aPinOrientationCode = PIN_ORIENTATION_CNT;
132 
133  return pin_orientation_names[ aPinOrientationCode ];
134 }
#define PIN_ORIENTATION_CNT
Definition: pin_type.cpp:108
#define _(s)
Definition: 3d_actions.cpp:33

References _, and PIN_ORIENTATION_CNT.

Referenced by SCH_PIN::GetMsgPanelInfo(), LIB_PIN::GetMsgPanelInfo(), and InitTables().

◆ PinOrientationNames()

const wxArrayString& PinOrientationNames ( )

Definition at line 218 of file pin_type.cpp.

219 {
220  if( g_orientationNames.empty() )
221  InitTables();
222 
223  return g_orientationNames;
224 }
void InitTables()
Definition: pin_type.cpp:160
static wxArrayString g_orientationNames
Definition: pin_type.cpp:39

References g_orientationNames, and InitTables().

Referenced by DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), PIN_TABLE_DATA_MODEL::GetValue(), and PIN_TABLE_DATA_MODEL::SetValue().

◆ PinShapeGetBitmap()

BITMAPS PinShapeGetBitmap ( GRAPHIC_PINSHAPE  shape)

Definition at line 267 of file pin_type.cpp.

268 {
269  auto findIt = pinShapes.find( aShape );
270 
271  wxCHECK_MSG( findIt != pinShapes.end(), BITMAPS::INVALID_BITMAP,
272  "Could not find pinshape in lookup map" );
273 
274  return findIt->second.bitmap;
275 }
const std::map< GRAPHIC_PINSHAPE, struct pinShapeStruct > pinShapes
Definition: pin_type.cpp:74

References INVALID_BITMAP, and pinShapes.

Referenced by InitTables(), and PinShapeComboBox::PinShapeComboBox().

◆ PinShapeGetText()

wxString PinShapeGetText ( GRAPHIC_PINSHAPE  shape)

Definition at line 257 of file pin_type.cpp.

258 {
259  auto findIt = pinShapes.find( aShape );
260 
261  wxCHECK_MSG( findIt != pinShapes.end(), wxT( "?" ), "Could not find pinshape in lookup map" );
262 
263  return findIt->second.name;
264 }
const std::map< GRAPHIC_PINSHAPE, struct pinShapeStruct > pinShapes
Definition: pin_type.cpp:74

References pinShapes.

Referenced by SCH_PIN::GetMsgPanelInfo(), LIB_PIN::GetMsgPanelInfo(), LIB_PIN::GetSelectMenuText(), InitTables(), and PinShapeComboBox::PinShapeComboBox().

◆ PinShapeIcons()

const std::vector<BITMAPS>& PinShapeIcons ( )

Definition at line 209 of file pin_type.cpp.

210 {
211  if( g_shapeIcons.empty() )
212  InitTables();
213 
214  return g_shapeIcons;
215 }
void InitTables()
Definition: pin_type.cpp:160
static std::vector< BITMAPS > g_shapeIcons
Definition: pin_type.cpp:35

References g_shapeIcons, and InitTables().

Referenced by SCH_PIN_TABLE_DATA_MODEL::BuildAttrs(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), and DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES().

◆ PinShapeNames()

◆ PinTypeIcons()

const std::vector<BITMAPS>& PinTypeIcons ( )

Definition at line 191 of file pin_type.cpp.

192 {
193  if( g_typeIcons.empty() )
194  InitTables();
195 
196  return g_typeIcons;
197 }
static std::vector< BITMAPS > g_typeIcons
Definition: pin_type.cpp:32
void InitTables()
Definition: pin_type.cpp:160

References g_typeIcons, and InitTables().

Referenced by SCH_PIN_TABLE_DATA_MODEL::BuildAttrs(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), and DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES().

◆ PinTypeNames()