simulavr  1.1.0
PortPin Class Reference

Pin class for HWPort, a special pin with override functionality for output stage. More...

#include <pin.h>

Inheritance diagram for PortPin:

Public Member Functions

 PortPin (void)
 common constructor, initial output state is tristate More...
 
virtual ~PortPin ()
 pin destructor, breaks save connection to other pins, if necessary More...
 
void ResetOverride (void)
 reset override states More...
 
void SetDDOV (bool val, int index=0)
 set data direction override value More...
 
void SetDDOE (bool val, int index=0)
 set data direction override enable More...
 
void SetPVOV (bool val, int index=0)
 set port override value More...
 
void SetPVOE (bool val, int index=0)
 set port override enable More...
 
void SetPVOE_WithDDR (bool val, int index=0)
 set port override enable, if DDR is set More...
 
void SetPUOV (bool val, int index=0)
 set pullup override value More...
 
void SetPUOE (bool val, int index=0)
 set pullup override enable More...
 
int RegisterAlternateUse (void)
 register an alternate function to pin More...
 
bool CalcPinOverride (bool ddr, bool port, bool pud)
 calculate pin outState with override functionality More...
 
- Public Member Functions inherited from Pin
 Pin (void)
 common constructor, initial output state is tristate More...
 
 Pin (const Pin &p)
 copy constructor, copy values but no refs to Net or HWPort More...
 
 Pin (T_Pinstate ps)
 copy constructor from pin state More...
 
 Pin (unsigned char *parentPin, unsigned char mask)
 constructor for a port pin, only used in UI part! More...
 
 Pin (float analog)
 constructor for analog pin More...
 
virtual ~Pin ()
 pin destructor, breaks save connection to other pins, if necessary More...
 
 operator char () const
 return char representation for output stage More...
 
virtual Pinoperator= (char)
 set output stage to (digital) state, set value for ANALOG state separately More...
 
virtual operator bool () const
 return boolean state of output stage More...
 
virtual Pin operator+ (const Pin &p)
 calculate common state from 2 connected pins More...
 
virtual Pin operator+= (const Pin &p)
 calculate common state from connected other pin to this pin More...
 
virtual void SetInState (const Pin &p)
 handles the input value from net More...
 
virtual void RegisterNet (Net *n)
 registers Net instance on pin More...
 
virtual void UnRegisterNet (Net *n)
 deletes Net instance registration for pin More...
 
virtual Pin GetPin (void)
 "cast method" to get back a Pin instance More...
 
int GetAnalog (void)
 Get analog value as integer from 0 to INT_MAX (for backward compatibility, will be deprecated later) More...
 
float GetRawAnalog (void) const
 get back raw analog value (just variable content!) More...
 
float GetAnalogValue (float vcc)
 Returns real analog input value of pin. More...
 
PinSetAnalogValue (float value)
 Sets the pin to an real analog value. More...
 
void SetRawAnalog (float value)
 
void RegisterCallback (HasPinNotifyFunction *)
 
bool CalcPin (void)
 Update input values from output values. More...
 
bool isPortPin (void)
 True, if it's a port pin. More...
 
bool isConnected (void)
 True, if it's connected to other pins. More...
 
bool hasListener (void)
 True, if there change listeners. More...
 

Protected Attributes

unsigned char DDOE
 
unsigned char DDOV
 
unsigned char PVOE
 
unsigned char PVOV
 
unsigned char PVOEwDDR
 
unsigned char PUOE
 
unsigned char PUOV
 
- Protected Attributes inherited from Pin
unsigned char * pinOfPort
 points to HWPort::pin or nullptr More...
 
IOReg< HWPort > * pinRegOfPort
 points to PIN io register of port or nullptr More...
 
unsigned char mask
 byte mask for HWPort::pin More...
 
AnalogValue analogVal
 "real" analog voltage value More...
 
NetconnectedTo
 the connection to other pins (nullptr, if not connected) More...
 

Private Attributes

unsigned int regCount
 register counter More...
 

Friends

class HWPort
 
class Net
 

Additional Inherited Members

- Public Types inherited from Pin
enum  T_Pinstate {
  LOW, HIGH, SHORTED, PULLUP,
  TRISTATE, PULLDOWN, ANALOG, ANALOG_SHORTED
}
 Possible PIN states. More...
 
- Public Attributes inherited from Pin
T_Pinstate outState
 discrete value of output stage More...
 
std::vector< HasPinNotifyFunction * > notifyList
 listeners for change of input value More...
 

Detailed Description

Pin class for HWPort, a special pin with override functionality for output stage.

Definition at line 169 of file pin.h.

Constructor & Destructor Documentation

◆ PortPin()

PortPin::PortPin ( void  )

common constructor, initial output state is tristate

Definition at line 355 of file pin.cpp.

◆ ~PortPin()

PortPin::~PortPin ( )
virtual

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

Definition at line 362 of file pin.cpp.

Member Function Documentation

◆ CalcPinOverride()

bool PortPin::CalcPinOverride ( bool  ddr,
bool  port,
bool  pud 
)

calculate pin outState with override functionality

Definition at line 427 of file pin.cpp.

References Pin::HIGH, Pin::LOW, Pin::PULLUP, and Pin::TRISTATE.

◆ RegisterAlternateUse()

int PortPin::RegisterAlternateUse ( void  )

register an alternate function to pin

Definition at line 373 of file pin.cpp.

Referenced by PinAtPort::PinAtPort().

◆ ResetOverride()

void PortPin::ResetOverride ( void  )

reset override states

Definition at line 367 of file pin.cpp.

◆ SetDDOE()

void PortPin::SetDDOE ( bool  val,
int  index = 0 
)

set data direction override enable

Definition at line 385 of file pin.cpp.

Referenced by PinAtPort::SetUseAlternateDdr().

◆ SetDDOV()

void PortPin::SetDDOV ( bool  val,
int  index = 0 
)

set data direction override value

Definition at line 378 of file pin.cpp.

Referenced by PinAtPort::SetAlternateDdr().

◆ SetPUOE()

void PortPin::SetPUOE ( bool  val,
int  index = 0 
)

set pullup override enable

Definition at line 420 of file pin.cpp.

Referenced by PinAtPort::SetUseAlternatePullup().

◆ SetPUOV()

void PortPin::SetPUOV ( bool  val,
int  index = 0 
)

set pullup override value

Definition at line 413 of file pin.cpp.

Referenced by PinAtPort::SetAlternatePullup().

◆ SetPVOE()

void PortPin::SetPVOE ( bool  val,
int  index = 0 
)

set port override enable

Definition at line 399 of file pin.cpp.

Referenced by PinAtPort::SetUseAlternatePort().

◆ SetPVOE_WithDDR()

void PortPin::SetPVOE_WithDDR ( bool  val,
int  index = 0 
)

set port override enable, if DDR is set

Definition at line 406 of file pin.cpp.

Referenced by PinAtPort::SetUseAlternatePortIfDdrSet().

◆ SetPVOV()

void PortPin::SetPVOV ( bool  val,
int  index = 0 
)

set port override value

Definition at line 392 of file pin.cpp.

Referenced by PinAtPort::SetAlternatePort().

Friends And Related Function Documentation

◆ HWPort

friend class HWPort
friend

Definition at line 203 of file pin.h.

◆ Net

friend class Net
friend

Definition at line 204 of file pin.h.

Member Data Documentation

◆ DDOE

unsigned char PortPin::DDOE
protected

Definition at line 175 of file pin.h.

◆ DDOV

unsigned char PortPin::DDOV
protected

Definition at line 176 of file pin.h.

◆ PUOE

unsigned char PortPin::PUOE
protected

Definition at line 180 of file pin.h.

◆ PUOV

unsigned char PortPin::PUOV
protected

Definition at line 181 of file pin.h.

◆ PVOE

unsigned char PortPin::PVOE
protected

Definition at line 177 of file pin.h.

◆ PVOEwDDR

unsigned char PortPin::PVOEwDDR
protected

Definition at line 179 of file pin.h.

◆ PVOV

unsigned char PortPin::PVOV
protected

Definition at line 178 of file pin.h.

◆ regCount

unsigned int PortPin::regCount
private

register counter

Definition at line 172 of file pin.h.


The documentation for this class was generated from the following files: