Digilent Constants¶
Constants for the Digilent devices. They are specified in dwf.h.
Note
This file is an adaptation of the examples provided by Digilent.
The basic approach is to device the parameters into different groups, such as DeviceFilter
or AcquisitionModes
.
Each one of them defines some class attributes with values, such as All = c_int(0)
. These classes can be used to
directly assess the values specified by Digilent, and they can also be instantiated. For example:
>>> df = DeviceFilter(c_int(2))
>>> print(df)
DeviceFilter - Discovery
>>> df == DeviceFilter.Discovery
True
>>> df == DeviceFilter.DDiscovery
False
This makes it clear when printing and enables quick comparisons that are easy to interpret. Ideally, the methods that return parameters should return instantiated classes. And the methods that use parameters as arguments whould implement them.
-
class
experimentor.drivers.digilent.dwfconst.
AcquisitionMode
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
acqmodeOvers
= c_int(4)¶
-
acqmodeRecord
= c_int(3)¶
-
acqmodeScanScreen
= c_int(2)¶
-
acqmodeScanShift
= c_int(1)¶
-
acqmodeSingle
= c_int(0)¶
-
acqmodeSingle1
= c_int(5)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
AnalogAcquisitionFilter
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
filterAverage
= c_int(1)¶
-
filterDecimate
= c_int(0)¶
-
filterMinMax
= c_int(2)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
AnalogChannelNodeType
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
analogioCurrent
= c_ubyte(3)¶
-
analogioEnable
= c_ubyte(1)¶
-
analogioPower
= c_ubyte(4)¶
-
analogioTemperature
= c_ubyte(5)¶
-
analogioVoltage
= c_ubyte(2)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
AnalogImpedance
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
DwfAnalogImpedanceAdmittance
= c_int(4)¶
-
DwfAnalogImpedanceAdmittancePhase
= c_int(5)¶
-
DwfAnalogImpedanceConductance
= c_int(6)¶
-
DwfAnalogImpedanceDissipation
= c_int(12)¶
-
DwfAnalogImpedanceImpedance
= c_int(0)¶
-
DwfAnalogImpedanceImpedancePhase
= c_int(1)¶
-
DwfAnalogImpedanceParallelCapacitance
= c_int(9)¶
-
DwfAnalogImpedanceParallelInductance
= c_int(11)¶
-
DwfAnalogImpedanceQuality
= c_int(13)¶
-
DwfAnalogImpedanceReactance
= c_int(3)¶
-
DwfAnalogImpedanceResistance
= c_int(2)¶
-
DwfAnalogImpedanceSeriesCapactance
= c_int(8)¶
-
DwfAnalogImpedanceSeriesInductance
= c_int(10)¶
-
DwfAnalogImpedanceSusceptance
= c_int(7)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
AnalogInTriggerMode
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
trigtypeEdge
= c_int(0)¶
-
trigtypePulse
= c_int(1)¶
-
trigtypeTransition
= c_int(2)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
AnalogOutIdle
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
DwfAnalogOutIdleDisable
= c_int(0)¶
-
DwfAnalogOutIdleInitial
= c_int(2)¶
-
DwfAnalogOutIdleOffset
= c_int(1)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
AnalogOutNode
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
AnalogOutNodeAM
= c_int(2)¶
-
AnalogOutNodeCarrier
= c_int(0)¶
-
AnalogOutNodeFM
= c_int(1)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
AnalogOutSignalType
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
funcCustom
= c_ubyte(30)¶
-
funcDC
= c_ubyte(0)¶
-
funcNoise
= c_ubyte(6)¶
-
funcPlay
= c_ubyte(31)¶
-
funcPulse
= c_ubyte(7)¶
-
funcRampDown
= c_ubyte(5)¶
-
funcRampUp
= c_ubyte(4)¶
-
funcSine
= c_ubyte(1)¶
-
funcSinePower
= c_ubyte(9)¶
-
funcSquare
= c_ubyte(2)¶
-
funcTrapezium
= c_ubyte(8)¶
-
funcTriangle
= c_ubyte(3)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
BaseConst
(value)[source]¶ Bases:
object
Base Constant to be used by the other groups of constants. It implements two fundamental approaches: it can be directly used by passing the result of a function call in the instantiation. This changes the string representation of the returned element to show the actual meaning. It also implements a pattern for checking equality, which simplifies checking if the returned value is the expected one.
-
class
experimentor.drivers.digilent.dwfconst.
DeviceFilter
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
All
= c_int(0)¶
-
DDiscovery
= c_int(4)¶
-
Discovery
= c_int(2)¶
-
Discovery2
= c_int(3)¶
-
EExplorer
= c_int(1)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
DeviceID
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
DDiscovery
= c_int(4)¶
-
Discovery
= c_int(2)¶
-
Discovery2
= c_int(3)¶
-
EExplorer
= c_int(1)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
DeviceVersion
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
DiscoveryA
= c_int(1)¶
-
DiscoveryB
= c_int(2)¶
-
DiscoveryC
= c_int(3)¶
-
EExplorerC
= c_int(2)¶
-
EExplorerE
= c_int(4)¶
-
EExplorerF
= c_int(5)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
DigitalClockSource
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
DwfDigitalInClockSourceExternal
= c_int(1)¶
-
DwfDigitalInClockSourceInternal
= c_int(0)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
DigitalInSampleMode
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
DwfDigitalInSampleModeNoise
= c_int(1)¶
-
DwfDigitalInSampleModeSimple
= c_int(0)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
DigitalOutIdle
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
DwfDigitalOutIdleHigh
= c_int(2)¶
-
DwfDigitalOutIdleInit
= c_int(0)¶
-
DwfDigitalOutIdleLow
= c_int(1)¶
-
DwfDigitalOutIdleZet
= c_int(3)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
DigitalOutOutput
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
DwfDigitalOutOutputOpenDrain
= c_int(1)¶
-
DwfDigitalOutOutputOpenSource
= c_int(2)¶
-
DwfDigitalOutOutputPushPull
= c_int(0)¶
-
DwfDigitalOutOutputThreeState
= c_int(3)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
DigitalOutType
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
DwfDigitalOutTypeCustom
= c_int(1)¶
-
DwfDigitalOutTypePlay
= c_int(5)¶
-
DwfDigitalOutTypePulse
= c_int(0)¶
-
DwfDigitalOutTypeROM
= c_int(3)¶
-
DwfDigitalOutTypeRandom
= c_int(2)¶
-
DwfDigitalOutTypeState
= c_int(4)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
EnumConfigInfo
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
DECIAnalogIOChannelCount
= c_int(3)¶
-
DECIAnalogInBufferSize
= c_int(7)¶
-
DECIAnalogInChannelCount
= c_int(1)¶
-
DECIAnalogOutBufferSize
= c_int(8)¶
-
DECIAnalogOutChannelCount
= c_int(2)¶
-
DECIDigitalIOChannelCount
= c_int(6)¶
-
DECIDigitalInBufferSize
= c_int(9)¶
-
DECIDigitalInChannelCount
= c_int(4)¶
-
DECIDigitalOutBufferSize
= c_int(10)¶
-
DECIDigitalOutChannelCount
= c_int(5)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
ErrorCodes
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
dwfercAlreadyOpened
= c_int(3)¶
-
dwfercApiLockTimeout
= c_int(2)¶
-
dwfercInvalidParameter0
= c_int(16)¶
-
dwfercInvalidParameter1
= c_int(17)¶
-
dwfercInvalidParameter2
= c_int(18)¶
-
dwfercInvalidParameter3
= c_int(19)¶
-
dwfercInvalidParameter4
= c_int(20)¶
-
dwfercNoErc
= c_int(0)¶
-
dwfercNotSupported
= c_int(4)¶
-
dwfercUnknownError
= c_int(1)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
InstrumentState
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
Armed
= c_ubyte(1)¶
-
Config
= c_ubyte(4)¶
-
Done
= c_ubyte(2)¶
-
Prefill
= c_ubyte(5)¶
-
Ready
= c_ubyte(0)¶
-
Running
= c_ubyte(3)¶
-
Triggered
= c_ubyte(3)¶
-
Wait
= c_ubyte(7)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
Params
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
DwfParamAudioOut
= c_int(5)¶
-
DwfParamLedBrightness
= c_int(3)¶
-
DwfParamOnClose
= c_int(4)¶
-
DwfParamUsbLimit
= c_int(6)¶
-
DwfParamUsbPower
= c_int(2)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
TriggerCondition
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
trigcondFallingNegative
= c_int(1)¶
-
trigcondRisingPositive
= c_int(0)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
TriggerLength
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
triglenLess
= c_int(0)¶
-
triglenMore
= c_int(2)¶
-
triglenTimeout
= c_int(1)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
TriggerSlope
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
TriggerSlopeEither
= c_int(2)¶
-
TriggerSlopeFall
= c_int(1)¶
-
TriggerSlopeRise
= c_int(0)¶
-
-
class
experimentor.drivers.digilent.dwfconst.
TriggerSource
(value)[source]¶ Bases:
experimentor.drivers.digilent.dwfconst.BaseConst
-
AnalogIn
= c_ubyte(4)¶
-
AnalogOut1
= c_ubyte(7)¶
-
AnalogOut2
= c_ubyte(8)¶
-
AnalogOut3
= c_ubyte(9)¶
-
AnalogOut4
= c_ubyte(10)¶
-
DetectorAnalogIn
= c_ubyte(2)¶
-
DetectorDigitalIn
= c_ubyte(3)¶
-
DigitalIn
= c_ubyte(5)¶
-
DigitalOut
= c_ubyte(6)¶
-
External1
= c_ubyte(11)¶
-
External2
= c_ubyte(12)¶
-
External3
= c_ubyte(13)¶
-
External4
= c_ubyte(14)¶
-
High
= c_ubyte(15)¶
-
Low
= c_ubyte(16)¶
-
PC
= c_ubyte(1)¶
-
none
= c_ubyte(0)¶
-