lsgunth / pyft232

Python bindings to d2xx and libftdi to access FT232 chips with the same interface as pyserial
GNU Lesser General Public License v2.1
11 stars 11 forks source link

work on #9: cbus_read() bugfix suggested by @lsgunth #10

Closed JBSchueler closed 5 years ago

JBSchueler commented 5 years ago

Applied bugfix for cbus_read()

lsgunth commented 5 years ago

I've made a small change to this because I'm worried python 2 won't work with it. Can you please test the "JBSchueler-feature/9_bugfix_cbus_read" branch in this repo?

Once you confirm it still works I'll merge it into master.

Thanks,

Logan

JBSchueler commented 5 years ago

I verified f5841f67dcef45c9938a71d72ef65a4534e9e8ff code has not been broken.

...
#If you want to use the CBUS pins, you enable them with cbus_setup
# 'mask' is a bitmask which specifies which pins to enable
# 'init' is a bitmask for the initial value for each pin
sp.cbus_setup(mask=3, init=3)

#Change the current value of all setup pins
sp.cbus_write(0)
print("CBUS = %s" % sp.cbus_read() )
sp.cbus_write(1)
print("CBUS = %s" % sp.cbus_read() )
sp.cbus_write(2)
print( "CBUS = %s" % sp.cbus_read() )
sp.cbus_write(3)
print( "CBUS = %s" % sp.cbus_read() )

result

c:\projects\python>py ftditest_2.py

Auto detecting FTDI devices
Serial          Description
------          -----------
A906WS3P         FT232R USB UART

Using :  A906WS3P

CBUS = 0
CBUS = 1
CBUS = 2
CBUS = 3

c:\projects\python>
JBSchueler commented 5 years ago

Verified on

Python 3.7.0a1 (v3.7.0a1:8f51bb4, Sep 19 2017, 19:32:44) [MSC v.1900 64 bit (AMD64)] on win32