1
/***************************************************************************
2
* Copyright (C) 2010 by santiago González *
3
* santigoro@gmail.com *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 3 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, see <http://www.gnu.org/licenses/>. *
18
***************************************************************************/
20
#ifndef ELOGICDEVICE_H
21
#define ELOGICDEVICE_H
28
class MAINMODULE_EXPORT eLogicDevice : public eElement
32
eLogicDevice( QString id );
35
int numInps() const { return m_numInputs; }
36
virtual void setNumInps( int inputs );
38
int numOuts() const { return m_numOutputs; }
39
void setNumOuts( int outputs );
41
double inputHighV() const { return m_inputHighV; }
42
void setInputHighV( double volt ) { m_inputHighV = volt; }
44
double inputLowV() const { return m_inputLowV; }
45
void setInputLowV( double volt ) { m_inputLowV = volt; }
47
double outHighV() const { return m_outHighV; }
48
void setOutHighV( double volt );
50
double outLowV() const { return m_outLowV; }
51
void setOutLowV( double volt );
53
double inputImp() const { return m_inputImp; }
54
void setInputImp( double imp );
56
double outImp() const { return m_outImp; }
57
void setOutImp( double imp );
59
bool clockInv() const { return m_clockSource->isInverted(); }
60
void setClockInv( bool inv );
62
bool inverted() { return m_inverted; }
63
void setInverted( bool inverted );
65
bool invertInps() { return m_invInputs; }
66
void setInvertInps( bool invert );
68
int eTrigger() { return m_etrigger; }
69
virtual void seteTrigger( int trigger );
71
void setOutputEnabled( bool enabled );
72
void updateOutEnabled();
74
virtual ePin* getEpin( QString pinName );
79
virtual void stamp() override;
80
virtual void initialize() override;
82
virtual void createPins( int inputs, int outputs );
83
void setClockPin( eSource* clockSource) { m_clockSource = clockSource; }
84
void setInput( int n, eSource* input );
85
void createClockPin();
86
void createOutEnablePin();
89
void createClockPin( ePin* epin );
90
void createClockeSource( ePin* epin );
91
void createOutEnablePin( ePin* epin );
92
void createOutEnableeSource( ePin* epin );
93
void createInput( ePin* epin );
94
void createOutput( ePin* epin );
96
void createInputs( int inputs );
97
void createOutputs( int outputs );
98
void deleteInputs( int inputs );
99
void deleteOutputs( int inputs );
100
void setOut( int num, bool out );
102
bool getInputState( int input );
103
bool getOutputState( int output );
123
eSource* m_outEnSource;
124
eSource* m_clockSource;
126
std::vector<eSource*> m_output;
127
std::vector<eSource*> m_input;
128
std::vector<bool> m_inputState;