KiCad PCB EDA Suite
pin_type.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
29 #include "pin_type.h"
30 
31 #include <macros.h>
32 
33 
35 {
36  wxString name;
38 };
39 
40 /*
41 * Conversion map between PLOT_DASH_TYPE values and style names displayed
42 */
43 // clang-format off
44 const std::map<ELECTRICAL_PINTYPE, struct pinTypeStruct> pinTypes = {
47  { ELECTRICAL_PINTYPE::PT_BIDI, { _( "Bidirectional" ), pintype_bidi_xpm } },
48  { ELECTRICAL_PINTYPE::PT_TRISTATE, { _( "Tri-state" ), pintype_3states_xpm } },
51  { ELECTRICAL_PINTYPE::PT_POWER_IN, { _( "Power input" ), pintype_powerinput_xpm } },
53  { ELECTRICAL_PINTYPE::PT_OPENCOLLECTOR,{ _( "Open collector" ), pintype_opencoll_xpm } },
54  { ELECTRICAL_PINTYPE::PT_OPENEMITTER, { _( "Open emitter" ), pintype_openemit_xpm } },
55  { ELECTRICAL_PINTYPE::PT_NC, { _( "Not connected" ), pintype_noconnect_xpm } },
56 };
57 // clang-format on
58 
60 {
61  auto findIt = pinTypes.find( aType );
62 
63  wxCHECK_MSG( findIt != pinTypes.end(), wxT( "???" ), "Could not find pin type in lookup map" );
64 
65  return findIt->second.name;
66 }
67 
68 
70 {
71  auto findIt = pinTypes.find( aType );
72 
73  wxCHECK_MSG( findIt != pinTypes.end(), nullptr, "Could not find pin type in lookup map" );
74 
75  return findIt->second.bitmap;
76 }
const BITMAP_OPAQUE pintype_bidi_xpm[1]
power input (GND, VCC for ICs). Must be connected to a power output.
PNG memory record (file in memory).
Definition: bitmap_def.h:29
const BITMAP_OPAQUE pintype_openemit_xpm[1]
Electrical pin type handling.
wxString ElectricalPinTypeGetText(ELECTRICAL_PINTYPE aType)
Definition: pin_type.cpp:59
pin for passive components: must be connected, and can be connected to any pin
unknown electrical properties: creates always a warning when connected
const BITMAP_OPAQUE pintype_notspecif_xpm[1]
const BITMAP_OPAQUE * bitmap
Definition: pin_type.cpp:37
This file contains miscellaneous commonly used macros and functions.
const BITMAP_OPAQUE pintype_noconnect_xpm[1]
const BITMAP_OPAQUE pintype_powerinput_xpm[1]
const std::map< ELECTRICAL_PINTYPE, struct pinTypeStruct > pinTypes
Definition: pin_type.cpp:44
wxString name
Definition: pin_type.cpp:36
const BITMAP_OPAQUE pintype_passive_xpm[1]
BITMAP_DEF ElectricalPinTypeGetBitmap(ELECTRICAL_PINTYPE aType)
Definition: pin_type.cpp:69
const BITMAP_OPAQUE pintype_3states_xpm[1]
ELECTRICAL_PINTYPE
The component library pin object electrical types used in ERC tests.
Definition: pin_type.h:37
#define _(s)
Definition: 3d_actions.cpp:33
usual pin input: must be connected
input or output (like port for a microprocessor)
const BITMAP_OPAQUE pintype_poweroutput_xpm[1]
const BITMAP_OPAQUE pintype_opencoll_xpm[1]
not connected (must be left open)
const BITMAP_OPAQUE pintype_input_xpm[1]
output of a regulator: intended to be connected to power input pins
const BITMAP_OPAQUE pintype_output_xpm[1]