File indexing completed on 2024-05-05 05:46:08

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by David Saxton                                    *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef PICCOMPONENTPIN_H
0012 #define PICCOMPONENTPIN_H
0013 
0014 #include "config.h"
0015 #ifndef NO_GPSIM
0016 
0017 #include "gpsim/stimuli.h"
0018 #include "logic.h"
0019 
0020 #include <QString>
0021 
0022 /**
0023 @short Controls a pin on the PIC component
0024 @author David Saxton
0025  */
0026 class PICComponentPin : public CallbackClass, public stimulus
0027 {
0028 public:
0029     PICComponentPin(PICComponent *picComponent, PicPin picPin);
0030     ~PICComponentPin() override;
0031     /**
0032      * Attach this to gpsim
0033      */
0034     void attach(IOPIN *iopin);
0035     /**
0036      * Called when the IOPIN this class is associated with changes state.
0037      * Updates the associated LogicOut / LogicIn / etc according to what
0038      * type of pin this is.
0039      */
0040     void set_nodeVoltage(double v) override;
0041     /**
0042      * Called from our logic pin when the logic changes state.
0043      */
0044     void logicCallback(bool state);
0045     /**
0046      * Sets the output (if has one) to low. Called when the user stops the
0047      * PIC.
0048      */
0049     void resetOutput();
0050 
0051     double get_Vth() override;
0052 
0053 protected:
0054     // Conductance of pin in different configurations
0055     double m_gOutHigh;
0056     double m_gOutLow;
0057 
0058     PicPin m_picPin;
0059     IOPIN *m_pIOPIN;
0060     LogicOut *m_pLogicOut;
0061     LogicIn *m_pLogicIn;
0062     PICComponent *m_pPICComponent;
0063     Stimulus_Node *m_pStimulusNode;
0064     const QString m_id;
0065 };
0066 
0067 #endif
0068 #endif