Wpdwf
Wrapper for Digilent Waveforms Application SDK
Wpdwf is an overlay for Waveforms Application runtime.
Overview
This library manages C types with ctypes module and gives to the
user a compact alternative to configure, for example, an Analog Discovery 3
with a minimum number of functions. It has the capability to discover multiple
devices, extract data and switch between them.
Code Snippets
wpdwf offers a simpler way to interact with Digilent Mixed Signal Products.
Conneting to a first device can be done using DeviceCfg, afterwards if multiple boards are needed, all can be grouped into a list and passed to WaveFormsCommonInstrumentation.
from wpdwf.deviceconfiguration import DeviceCfg
from wpdwf.wfcommoninstruments import WaveFormsCommonInstrumentation
idxDev = 0
dev = DeviceCfg()
print(dev)
wfci = WaveFormsCommonInstrumentation(lsDevsToUse=[dev])
wfci.disconnect(idxDev)
Devices offers the following functions findDev, findDevByIdx, findDevByName, findDevByConfig to search for devices connected to the host PC. These store data internally into Devices' attributes.
from wpdwf.deviceconfiguration import Devices
devs = Devices()
tDevs = devs.sweepDevs() # returns a tuple
print(tDevs)
To configure IO instrument a local dict should be created as the one below because IO sub-functions separates them internally. One call to confDI enables it (Outputs for DIO in this case), then another call starts DIO6, DIO8 on high (3V3 default). To change logic level some functionalities from Analog instruments are needed, but will come in the next version.
from wpdwf.deviceconfiguration import DeviceCfg
from wpdwf.wfcommoninstruments import WaveFormsCommonInstrumentation
idxDev = 0
# i... prefix ~ value that is modified
lcData = {
"Io" : {
"bReset":False,"bStatus":False,
"bEnable":True,"bInfo":False,
"format":32,
"dDio":{"DIO0":0,"DIO1":0,"DIO2":0,"DIO3":0,
"DIO4":0,"DIO5":0,"DIO6":1,"DIO7":1,
"DIO8":0,"DIO9":0,"DIO10":0,"DIO11":0,
"DIO12":0,"DIO13":0,"DIO14":0,"DIO15":0},
"dOutput":{"Mask":0,"DIO":-1,"iDIO":-1},
"dPull":{"PullUp":0,"PullDown":0,
"iPullUp":0,"iPullDown":0,
"MaskPullUp":0,"MaskPullDown":0},
"dDrive":{"Channel":0,"Amplitude":0.0,"Slew":0,
"iAmplitude":0.0,"iSlew":0,"AmpMin":0.0,
"AmpMax":0.0,"AmpSteps":0,"SlewSteps":0},
"dInput":{"stsMask":0,"Mask":0}
}
}
dev = DeviceCfg()
wfci = WaveFormsCommonInstrumentation(lsDevsToUse=[dev])
wfci.confDI(nrDev=idxDev, dInstFlags={"IO":True},
dFlags={"Io":True},
data=lcData
)
lcData["Io"]["bEnable"] = False
wfci.confDI(nrDev=idxDev, dInstFlags={"IO":True},
dFlags={"Io":True},
data=lcData
)
To configure Digital Protocols instrument a local dict should be created as the one below because DP sub-functions separates them internally. One call to confDI is enough to write or read data on Uart.
from wpdwf.deviceconfiguration import DeviceCfg
from wpdwf.wfcommoninstruments import WaveFormsCommonInstrumentation
idxDev = 0
lcData = {
"Uart" : {
"bReset":False,"frequency":9600,
"bRead":False,"bWrite":True,
"chDIOTx":7,"chDIORx":6,
"nrCntTx":5,
"data":{"Polarity":0,"Parity":0,"BufferTx":[1,2,3,4,5],
"BufferRx":[],"CntRx":0}
}
}
dev = DeviceCfg()
wfci = WaveFormsCommonInstrumentation(lsDevsToUse=[dev])
wfci.confDI(nrDev=idxDev, dInstFlags={"DigitalProtocols":True},
dFlags={"Uart":True},
data=lcData
)
Project Information
For v0.0.1:
- Multiple devices can be detected and used
- Instruments
- Digital IO
- Digital Protocols
More Information
This is not open-source so as others can contibute to it due to internal resons, but it will be in the future. In file wfcommoninstruments.py, there are data templates for implemented instruments configurations (confDI member function).
Release files for wpdwf 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wpdwf-0.0.1.tar.gz | 62.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wpdwf-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 127.7 kB
Release files / wpdwf-0.0.1.tar.gz
| Download URL | wpdwf-0.0.1.tar.gz |
|---|---|
| Size | 62.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88728b20fb7996781df4249e5c7230d5322c98c216e9f3b600923ba50330b220
|
|
BLAKE2b-256 checksum How to use checksums |
4e0912bb0683a929f025635911a89ca1044381a5c02c4d0585906ef6d4f936c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|
Release files / wpdwf-0.0.1-py3-none-any.whl
| Download URL | wpdwf-0.0.1-py3-none-any.whl |
|---|---|
| Size | 64.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8987f23f427496dbc4e2229743e849bcc80fac7c14cfbcbe8c0de47af1dcee1
|
|
BLAKE2b-256 checksum How to use checksums |
75e4f354283f850208bdc7397cfcd0ecb44cb1d6e52d1b55c2e835ea2b388c40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.7
|