addac.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by David Saxton                                    *
00003  *   david@bluehaze.org                                                    *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #ifndef ADDAC_H
00012 #define ADDAC_H
00013 
00014 #include "component.h"
00015 
00016 const int max_ADDAC_bits = 32;
00017 
00022 class ADDAC : public Component
00023 {
00024 public:
00025         public:
00026                 ADDAC( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00027                 ~ADDAC();
00028                 virtual bool canFlip() const { return true; }
00029                 
00030         protected:
00031                 void dataChanged();
00035                 virtual void initPins() = 0;
00036                 
00037                 int m_numBits;
00038                 double m_range;
00039 };
00040 
00041 
00048 class ADC : public ADDAC
00049 {
00050         public:
00051                 ADC( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00052                 ~ADC();
00053         
00054                 static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
00055                 static LibraryItem *libraryItem();
00056         
00057                 virtual void stepNonLogic();
00058                 virtual bool doesStepNonLogic() const { return true; }
00059         
00060         protected:
00064                 virtual void initPins();
00065         
00066                 LogicOut *m_logic[max_ADDAC_bits];
00067                 ECNode *m_realNode;
00068 };
00069 
00070 
00075 // TODO: make it possible to select current source or voltage source dac. =) 
00076 
00077 class DAC : public ADDAC
00078 {
00079         public:
00080                 DAC( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00081                 ~DAC();
00082         
00083                 static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
00084                 static LibraryItem *libraryItem();
00085         
00086                 virtual void stepNonLogic();
00087                 virtual bool doesStepNonLogic() const { return true; }
00088         
00089         protected:
00093                 virtual void initPins();
00094         
00095                 LogicIn *m_logic[max_ADDAC_bits];
00096                 VoltagePoint *m_voltagePoint;
00097 };
00098 
00099 
00100 #endif

Generated on Tue May 8 17:05:27 2007 for KTechLab by  doxygen 1.5.1