Skip to content

Conversation

@talhaHavadar
Copy link

@talhaHavadar talhaHavadar commented Dec 1, 2023

This commit adds the capability of using FtdiEeprom.CBUS, CBUSH and CBUSX while setting cbus functionality as shown in the example below.

	eeprom = FtdiEeprom()
	eeprom.connect(f) # f is the instance of Ftdi
	eeprom.set_property("cbus_func_0", eeprom.CBUSX.GPIO)

Previously, we had to use the string to set the property for specific CBUS. And when we want to use it like the example above it was giving the following error messages:

Traceback (most recent call last):
  File "/home/talha/projects/pyftdi/test.py", line 45, in <module>
    eeprom.set_property("cbus_func_0", eeprom.CBUSX.GPIO)
  File "/home/talha/projects/pyftdi/pyftdi/eeprom.py", line 490, in set_property
    raise ValueError("'{name}' should be specified as a string")
ValueError: '{name}' should be specified as a string
Traceback (most recent call last):
  File "/home/talha/projects/pyftdi/test.py", line 45, in <module>
    eeprom.set_property("cbus_func_0", eeprom.CBUSX.GPIO)
  File "/home/talha/projects/pyftdi/pyftdi/eeprom.py", line 491, in set_property
    self._set_cbus_func(int(mobj.group(1)), value, out)
  File "/home/talha/projects/pyftdi/pyftdi/eeprom.py", line 896, in _set_cbus_func
    code = cbus[value.upper()].value
AttributeError: 'CBusX' object has no attribute 'upper'

This commit adds the capability of using FtdiEeprom.CBUS, CBUSH and CBUSX
while setting cbus functionality as shown in the example below.
	eeprom = FtdiEeprom()
	eeprom.connect(f) # f is the instance of Ftdi
	eeprom.set_property("cbus_func_0", eeprom.CBUSX.GPIO)

Previously, we had to use the string to set the property for specific CBUS

Signed-off-by: Talha Can Havadar <[email protected]>
Co-authored-by: Evandro Arruda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants