Pin Class Reference

yasimavr: Pin Class Reference
yasimavr
Loading...
Searching...
No Matches

MCU pin model. More...

#include <sim_pin.h>

Inheritance diagram for Pin:
Wire

Classes

struct  controls_t
 

Public Member Functions

 Pin (pin_id_t id)
 
pin_id_t id () const
 
void set_external_state (const state_t &state)
 
void set_external_state (StateEnum state, double level=0.0)
 
void set_external_state (char state, double level=0.0)
 
void set_gpio_controls (const controls_t &controls)
 
controls_t gpio_controls () const
 
 Pin (const Pin &)=delete
 
Pinoperator= (const Pin &)=delete
 
- Public Member Functions inherited from Wire
 Wire ()
 
 Wire (Wire &other)
 
 Wire (const Wire &other)
 
virtual ~Wire ()
 
DataSignalsignal ()
 
const state_tstate () const
 
bool digital_state () const
 
double voltage () const
 
void set_state (const state_t &state)
 
void set_state (StateEnum state, double v=0.0)
 
void set_state (char state, double v=0.0)
 
void attach (Wire &other)
 
void detach ()
 
bool attached (const Wire &other) const
 
bool attached () const
 
std::vector< Wire * > siblings () const
 
Wireoperator= (Wire &other)
 
Wireoperator= (const Wire &other)
 

Friends

class PinManager
 
class PinDriver
 

Additional Inherited Members

- Public Types inherited from Wire
enum  StateEnum {
  State_Floating = 0x00 , State_PullUp = 0x03 , State_PullDown = 0x01 , State_Analog = 0x04 ,
  State_High = 0x07 , State_Low = 0x05 , State_Shorted = 0x80 , State_Error = 0x90
}
 
enum  SignalId { Signal_StateChange = 0 , Signal_DigitalChange , Signal_VoltageChange }
 
- Static Public Member Functions inherited from Wire
static StateEnum char2state (char c)
 
static state_t resolve_two_states (const state_t &a, const state_t &b)
 
- Protected Member Functions inherited from Wire
void auto_resolve_state ()
 

Detailed Description

MCU pin model.

Pin represents a external pad of the MCU used for GPIO. The pin has two electrical states given by the external circuit and the internal circuit (the GPIO port), which are resolved into a single electrical state. In case of conflict, the SHORTED state is set. The internal circuit state is set by GPIO controls.

Constructor & Destructor Documentation

◆ Pin() [1/2]

Pin::Pin ( pin_id_t  id)
explicit

◆ Pin() [2/2]

Pin::Pin ( const Pin )
delete

Member Function Documentation

◆ gpio_controls()

Pin::controls_t Pin::gpio_controls ( ) const
inline

Getter for the GPIO controls currently applied

◆ id()

pin_id_t Pin::id ( ) const
inline

◆ operator=()

Pin & Pin::operator= ( const Pin )
delete

◆ set_external_state() [1/3]

void Pin::set_external_state ( char  state,
double  level = 0.0 
)
inline

Set the state applied to the pin by the external circuit. Valid values for state are defined in Wire.

See also
Wire::char2state

◆ set_external_state() [2/3]

void Pin::set_external_state ( const state_t state)
inline

Set the state applied to the pin by the external circuit

◆ set_external_state() [3/3]

void Pin::set_external_state ( StateEnum  state,
double  level = 0.0 
)
inline

Set the state applied to the pin by the external circuit

◆ set_gpio_controls()

void Pin::set_gpio_controls ( const controls_t controls)

Set the controls for the internal circuit state

Friends And Related Symbol Documentation

◆ PinDriver

friend class PinDriver
friend

◆ PinManager

friend class PinManager
friend

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