Class Wire
Defined in File sim_wire.h
Nested Relationships
Nested Types
Inheritance Relationships
Derived Type
public Pin(Class Pin)
Class Documentation
-
class Wire
General Purpose wire model.
This class models a logical line used to represents digital/analog electrical signals. Its main purpose is to serve as base class for the MCU pin models and can be used by external component models to simulate digital or analog signals connected to a MCU model.
Wires need to be attached to each other. An attachment represents an electrical connection between two input and/or output circuits. Wires have a individual state (one of the State enum values) representing how the local circuit is driving them (or not driving) and a resolved state, shared by all attached Wires representing the common state.
For example, if Wires A and B are attached, A’s state is Floating, B’s state is High, the common resolved state is High.
As for the rest of the library, analog voltage levels are relative to VCC, hence limited to the range [0.0, 1.0].
See also
Subclassed by Pin
Public Types
-
enum StateEnum
Pin state enum. All the possible logical/analog electrical states that the wire can take.
Values:
-
enumerator State_Floating
-
enumerator State_PullUp
-
enumerator State_PullDown
-
enumerator State_Analog
-
enumerator State_High
-
enumerator State_Low
-
enumerator State_Shorted
-
enumerator State_Error
-
enumerator State_Floating
-
enum SignalId
Signal IDs raised by the pin. For all signals, the index is set to the pin ID.
Values:
-
enumerator Signal_StateChange
Signal raised for any change of the resolved state. data is set to the new state (one of State enum values)
-
enumerator Signal_StateChange
Public Functions
-
virtual ~Wire()
-
inline DataSignal &signal()
- Returns:
the signal raising the state/value changes
-
bool digital_state() const
Returns the resolved state reduced to a boolean.
-
inline double voltage() const
- Returns:
the pin voltage value
-
inline void set_state(StateEnum state, double v = 0.0)
Set the state of the wire using one of the StateEnum values
- Parameters:
state – new Wire state
level – voltage level (only for the Analog state)
-
inline void set_state(char state, double v = 0.0)
Set the state of the wire using a charcode
See also
- Parameters:
state – new Wire state
level – voltage level (only for the Analog state)
-
bool attached(const Wire &other) const
- Returns:
whether ‘this’ is attached to the other Wire object.
Public Static Functions
-
class state_t
-
enum StateEnum