Skip to main content

Python bindings to d2xx and libftdi to access FT232 chips with the same interface as pyserial. Using this method gives easy access to the additional features on the chip like CBUS GPIO.

Project description

pyft232

This module provides a simple Serial-Like interface to FT232 chips while still allowing access to the CBUS pins for controlling simple signals.

Ctypes is used to interface with either FTDI's d2xx library (when available) or libftdi. In this way this package works on both Windows and Linux (and other libftdi supported OS's) without needing to mess with the FTDI drivers on windows.

In contrast, pyftdi is more feature rich and also cross platform but requires special drivers on windows so you can't also use the FTDI chip as a pure COM port.

Usage

import ft232

serial_number = "FT1234"

try:
    sp = ft232.Ft232(serial_number, baudrate=115200)
except ft232.Ft232Exception:
    print("Unable to open the ftdi device: %s" % serial_number)
    sys.exit(1)

#You may use sp as you would a Serial object
sp.write(b"Hello World!\n")
resp = sp.read(100)

#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(2)

#Print the current value of all setup pins
print("CBUS: %s" % sp.cbus_read())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyft232-0.9.tar.gz (16.0 kB view details)

Uploaded Source

File details

Details for the file pyft232-0.9.tar.gz.

File metadata

  • Download URL: pyft232-0.9.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.5.3

File hashes

Hashes for pyft232-0.9.tar.gz
Algorithm Hash digest
SHA256 dfd11ad938c1da17383619c694184d45ebefb905c908b17fbf95093af1045b76
MD5 99860367bf42d6e2f2f42a6f87c4c456
BLAKE2b-256 72c58c770dbb8ca9f0576711e5bb232da8948bcf7fa4a6ce8140e9a327aaf71c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page