Jump to content
  • 0

Waveforms SDK throwing errors with static supply tests


gabagool

Question

Hi,

I'm trying to write a test application for the Analog Discovery 3 which utilises the DIO channels. From my understanding, the static.py file contains the library functions for this, and also the test_static-supplies.py file exists for testing purposes. When I run the test_static-supplies.py test file, it returns the following once reaching here:

# set the state of every DIO channel
static.set_state(device_data, index, not(mask & pow(2, index)))

and the error:

Exception has occurred: TypeError
unsupported operand type(s) for &=: 'c_ushort' and 'int'
  File "C:\Program Files (x86)\Digilent\WaveFormsSDK\inc\WF_SDK\samples\test_static-supplies.py", line 36, in <module>
    static.set_state(device_data, index, not(mask & pow(2, index)))
TypeError: unsupported operand type(s) for &=: 'c_ushort' and 'int'

 

From the library side, it seems to be complaining due to this in the set_state function:
 

    # set bit in mask
    if value == True:
        mask |= __rotate_left__(1, channel, data.count)
    else:
        bits = pow(2, data.count) - 2
        mask &= __rotate_left__(bits, channel, data.count)

I've tried casting mask to a uint16_t, an int, and an short but still receive the same result (or variations of it complaining about unsupported operand types).

 

Am I doing something wrong here?

Edited by gabagool
tags
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Loosely related, but is it possible the SDK has not been updated for Analog Discovery 3 devices? I've started to try use the library functions directly, and trying to get the device name with:

dwf.FDwfEnum(c_int(0), byref(numDevices))
for iDevice in range(0, numDevices.value):
    dwf.FDwfEnumDeviceName(c_int(iDevice), devicename)
    print("Device: " + str(iDevice+1)+" : \t" + str(devicename.value))

returns:

Device: 1 :     b'Analog Discovery 3'

 

Whereas with the SDK:

device_data = device.open()
print("Device name: " + device_data.name + "\n")

returns and empty:

Device name: 

 

Following into the open function of device.py I see that the Discovery 3 is not listed in the constants module which seems to come from "import dwfconstants as constants":

    device_names = [("Analog Discovery", constants.devidDiscovery), ("Analog Discovery 2", constants.devidDiscovery2),
                    ("Analog Discovery Studio", constants.devidDiscovery2), ("Digital Discovery", constants.devidDDiscovery),
                    ("Analog Discovery Pro 3X50", constants.devidADP3X50), ("Analog Discovery Pro 5250", constants.devidADP5250)]

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...