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 maskif 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).
Question
gabagool
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:
From the library side, it seems to be complaining due to this in the set_state function:
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 gabagooltags
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now