Pin Class Reference

Pin class, handles input and output to external parts. More...

#include <pin.h>

Inheritance diagram for Pin:
Inheritance graph
[legend]
Collaboration diagram for Pin:
Collaboration graph
[legend]

List of all members.

Public Types

enum  T_Pinstate {
  LOW, HIGH, SHORTED, PULLUP,
  TRISTATE, PULLDOWN, ANALOG, ANALOG_SHORTED
}
 

Possible PIN states.

More...

Public Member Functions

 Pin (void)
 common constructor, initial output state is tristate
 Pin (const Pin &p)
 copy constructor, copy values but no refs to Net or HWPort
 Pin (const OpenDrain &od)
 copy constructor, if we take values from OpenDrain pin
 Pin (T_Pinstate ps)
 copy constructor from pin state
 Pin (unsigned char *parentPin, unsigned char mask)
 constructor for a port pin
virtual ~Pin ()
 pin destructor, breaks save connection to other pins, if necessary
 operator char () const
virtual Pinoperator= (char)
virtual operator bool () const
virtual Pin operator+ (const Pin &p)
virtual Pin operator+= (const Pin &p)
virtual void SetInState (const Pin &p)
 handles the input value from net
virtual void RegisterNet (Net *n)
 registers Net instance on pin
virtual void UnRegisterNet (Net *n)
 deletes Net instance registration for pin
virtual Pin GetPin (void)
 "cast method" to get back a Pin instance
int GetAnalog (void) const
 Returns analog input value of pin.
PinSetAnalog (int value)
 Sets the pin to an analog value.
void RegisterCallback (HasPinNotifyFunction *)
bool CalcPin (void)
 Update input values from output values.
bool isPortPin (void)
 True, if it's a port pin.
bool isConnected (void)
 True, if it's connected to other pins.
bool hasListener (void)
 True, if there change listeners.

Public Attributes

T_Pinstate outState
 discret value of output stage
std::vector
< HasPinNotifyFunction * > 
notifyList
 listeners for change of input value

Protected Attributes

unsigned char * pinOfPort
 points to HWPort::pin or NULL
unsigned char mask
 byte mask for HWPort::pin
int analogValue
 analog input value, from 0 to INT_MAX
NetconnectedTo
 the connection to other pins (NULL, if not connected)

Friends

class HWPort
class Net

Detailed Description

Pin class, handles input and output to external parts.

This isn't a simple electrical point with a electrical potential. Pin class simulates mostly complete Input/Output circuit. So you have a output stage and a input state. Such a pin is connected by a net (see Net class) with other pins.

Definition at line 47 of file pin.h.


Member Enumeration Documentation

Possible PIN states.

This are the discret states of output stage and input value.

Warning:
Please do not change the order of these values without thinking twice, as for example the simulavrxx VPI interface depends on this/exports this to verilog.
Enumerator:
LOW 
HIGH 
SHORTED 
PULLUP 
TRISTATE 
PULLDOWN 
ANALOG 
ANALOG_SHORTED 

Definition at line 63 of file pin.h.


Constructor & Destructor Documentation

Pin::Pin ( void   ) 

common constructor, initial output state is tristate

Definition at line 126 of file pin.cpp.

References analogValue, connectedTo, outState, pinOfPort, TRISTATE, and TRISTATE_ANALOG_VALUE.

Referenced by OpenDrain::GetPin(), OpenDrain::operator+(), and operator+().

Here is the caller graph for this function:

Pin::Pin ( const Pin p  ) 

copy constructor, copy values but no refs to Net or HWPort

Definition at line 148 of file pin.cpp.

References analogValue, connectedTo, outState, and pinOfPort.

Pin::Pin ( const OpenDrain od  ) 

copy constructor, if we take values from OpenDrain pin

Definition at line 259 of file pin.cpp.

References analogValue, LOW, outState, TRISTATE, and TRISTATE_ANALOG_VALUE.

Pin::Pin ( T_Pinstate  ps  ) 

copy constructor from pin state

Definition at line 99 of file pin.cpp.

References analogValue, connectedTo, HIGH, LOW, outState, pinOfPort, PULLDOWN, PULLUP, TRISTATE, and TRISTATE_ANALOG_VALUE.

Pin::Pin ( unsigned char *  parentPin,
unsigned char  mask 
)

constructor for a port pin

Definition at line 139 of file pin.cpp.

References analogValue, connectedTo, mask, outState, pinOfPort, TRISTATE, and TRISTATE_ANALOG_VALUE.

Pin::~Pin (  )  [virtual]

pin destructor, breaks save connection to other pins, if necessary

Definition at line 134 of file pin.cpp.

References connectedTo, and UnRegisterNet().

Here is the call graph for this function:


Member Function Documentation

bool Pin::CalcPin ( void   ) 

Update input values from output values.

If there is no connection to other pins, then it will reflect the own output value to own input value. Otherwise it calls Net::CalcNet method

Definition at line 89 of file pin.cpp.

References Net::CalcNet(), connectedTo, and SetInState().

Referenced by operator=(), and SetAnalog().

Here is the call graph for this function:

Here is the caller graph for this function:

int Pin::GetAnalog ( void   )  const

Returns analog input value of pin.

Definition at line 45 of file pin.cpp.

References ANALOG, analogValue, HIGH, LOW, outState, PULLDOWN, PULLUP, and TRISTATE.

Referenced by HWAd::CpuCycle(), PinAtPort::GetAnalog(), HWAdmux::GetMuxOutput(), and Scope::SetInStateForChannel().

Here is the caller graph for this function:

virtual Pin Pin::GetPin ( void   )  [inline, virtual]

"cast method" to get back a Pin instance

Reimplemented in OpenDrain, and SwigDirector_Pin.

Definition at line 97 of file pin.h.

bool Pin::hasListener ( void   )  [inline]

True, if there change listeners.

Definition at line 108 of file pin.h.

References notifyList.

bool Pin::isConnected ( void   )  [inline]

True, if it's connected to other pins.

Definition at line 107 of file pin.h.

References connectedTo.

bool Pin::isPortPin ( void   )  [inline]

True, if it's a port pin.

Definition at line 106 of file pin.h.

References pinOfPort.

Pin::operator bool (  )  const [virtual]

Reimplemented in OpenDrain.

Definition at line 181 of file pin.cpp.

References ANALOG, analogValue, HIGH, outState, PULLUP, and TRISTATE.

Pin::operator char (  )  const

Definition at line 167 of file pin.cpp.

References ANALOG, ANALOG_SHORTED, HIGH, LOW, outState, PULLDOWN, PULLUP, SHORTED, and TRISTATE.

Pin Pin::operator+ ( const Pin p  )  [virtual]

Reimplemented in OpenDrain.

Definition at line 271 of file pin.cpp.

References ANALOG, ANALOG_SHORTED, HIGH, LOW, outState, Pin(), PULLDOWN, PULLUP, SHORTED, and TRISTATE.

Here is the call graph for this function:

Pin Pin::operator+= ( const Pin p  )  [virtual]

Reimplemented in OpenDrain.

Definition at line 253 of file pin.cpp.

Pin & Pin::operator= ( char  c  )  [virtual]

Definition at line 196 of file pin.cpp.

References ANALOG, ANALOG_SHORTED, analogValue, CalcPin(), HIGH, LOW, outState, PULLDOWN, PULLUP, SHORTED, TRISTATE, and TRISTATE_ANALOG_VALUE.

Here is the call graph for this function:

void Pin::RegisterCallback ( HasPinNotifyFunction h  ) 

register a listener for input value change

Definition at line 66 of file pin.cpp.

References notifyList.

Referenced by ExternalIRQPort::ExternalIRQPort(), ExternalIRQSingle::ExternalIRQSingle(), HWAcomp::HWAcomp(), PinMonitor::PinMonitor(), SerialRx::SerialRx(), and SerialRxBasic::SerialRxBasic().

Here is the caller graph for this function:

void Pin::RegisterNet ( Net n  )  [virtual]

registers Net instance on pin

Reimplemented in OpenDrain, and SwigDirector_Pin.

Definition at line 156 of file pin.cpp.

References connectedTo, and UnRegisterNet().

Referenced by Net::Add(), and OpenDrain::RegisterNet().

Here is the call graph for this function:

Here is the caller graph for this function:

Pin & Pin::SetAnalog ( int  value  ) 

Sets the pin to an analog value.

Definition at line 244 of file pin.cpp.

References analogValue, and CalcPin().

Here is the call graph for this function:

void Pin::SetInState ( const Pin p  )  [virtual]

handles the input value from net

Reimplemented in SwigDirector_Pin, ExtPin, ExtAnalogPin, and ScopePin.

Definition at line 70 of file pin.cpp.

References analogValue, mask, notifyList, and pinOfPort.

Referenced by avr_set_pin_tf(), Net::CalcNet(), and CalcPin().

Here is the caller graph for this function:

void Pin::UnRegisterNet ( Net n  )  [virtual]

deletes Net instance registration for pin

Reimplemented in SwigDirector_Pin.

Definition at line 161 of file pin.cpp.

References connectedTo, and Net::Delete().

Referenced by RegisterNet(), and ~Pin().

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class HWPort [friend]

Definition at line 110 of file pin.h.

friend class Net [friend]

Definition at line 111 of file pin.h.


Member Data Documentation

int Pin::analogValue [protected]

analog input value, from 0 to INT_MAX

Definition at line 52 of file pin.h.

Referenced by GetAnalog(), operator bool(), operator=(), Pin(), SetAnalog(), AdcAnalogPin::setAnalogValue(), SetInState(), and ExtAnalogPin::SetNewValueFromUi().

Net* Pin::connectedTo [protected]

the connection to other pins (NULL, if not connected)

Definition at line 54 of file pin.h.

Referenced by CalcPin(), isConnected(), Pin(), RegisterNet(), AdcAnalogPin::setAnalogValue(), ExtAnalogPin::SetNewValueFromUi(), ExtPin::SetNewValueFromUi(), UnRegisterNet(), and ~Pin().

unsigned char Pin::mask [protected]

byte mask for HWPort::pin

Definition at line 51 of file pin.h.

Referenced by HWPort::HWPort(), Pin(), and SetInState().

listeners for change of input value

Definition at line 75 of file pin.h.

Referenced by hasListener(), RegisterCallback(), and SetInState().

unsigned char* Pin::pinOfPort [protected]

points to HWPort::pin or NULL

Definition at line 50 of file pin.h.

Referenced by HWPort::HWPort(), isPortPin(), Pin(), and SetInState().


The documentation for this class was generated from the following files:
Generated on Sun Feb 12 16:52:55 2012 for Simulavr by  doxygen 1.6.3