-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't push data to eeprom #65
Comments
@VadalTheGod Looks like you're right. Could you try if the following works: def eeUAWrite(self, data: bytes) -> None:
"""Write data to the EEPROM user area. data must be a bytes object with
appropriate byte values"""
buf = (c.c_ubyte*len(data)).from_buffer_copy(data)
call_ft(_ft.FT_EE_UAWrite, self.handle, buf, len(data)) |
Sorry, that i haven't answered for a long time. I checked your code and it works correctly. |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I'm correctly connect with eeprom but when i'm trying to push data into it it doesn't work.
To Reproduce
I think there's problem with eeUAWrite function in ftd2xx.py file where casting function works wrong
Expected behavior
Correctly casting types and pushing data to eeprom
Logs
File "/usr/local/lib/python3.9/dist-packages/ftd2xx/ftd2xx.py", line 577, in eeUAWrite call_ft(_ft.FT_EE_UAWrite, self.handle, buf, len(data)) File "/usr/local/lib/python3.9/dist-packages/ftd2xx/ftd2xx.py", line 131, in call_ft status = function(*args) ctypes.ArgumentError: argument 2: <class 'TypeError'>: expected LP_c_ubyte instance instead of c_char_Array_97
Desktop (please complete the following information):
Additional context
I found a solution. It works correctly.
Original code look like:
def eeUAWrite(self, data: bytes) -> None: """Write data to the EEPROM user area. data must be a string with appropriate byte values""" buf = c.create_string_buffer(data) call_ft(_ft.FT_EE_UAWrite, self.handle, ptr, len(data))
I change second line as below:
def eeUAWrite(self, data: bytes) -> None: """Write data to the EEPROM user area. data must be a string with appropriate byte values""" ptr = c.cast(c.c_char_p(data),c.POINTER(c.c_ubyte)) call_ft(_ft.FT_EE_UAWrite, self.handle, ptr, len(data))
The text was updated successfully, but these errors were encountered: