Skip to main content

Python wrapper around libFT4222.

Project description

python-ft4222

The FT4222H is a High/Full Speed USB2.0-to-Quad SPI/I2C device controller. This project provides (incomplete) python binding to LibFT4222 (user guide). It provides a similar api than LibFT4222 does.

The complete documentation can be found here

Example

I2C Master

import ft4222
import ft4222.I2CMaster


# list devices
nbDev = ft4222.createDeviceInfoList()
for i in range(nbDev):
    print(ft4222.getDeviceInfoDetail(i, False))

# open device with default description 'FT4222 A'
dev = ft4222.openByDescription('FT4222 A')

# init i2c master, clock speed 100kHz
dev.i2cMaster_Init(100)

# do a i2c transfers where full control is required
slave = 1 # address
# read one byte, don't stop
data = dev.i2cMaster_ReadEx(slave, ft4222.I2CMaster.Flag.REPEATED_START, 1)[0]
# read another 5 bytes
data += dev.i2cMaster_ReadEx(slave, ft4222.I2CMaster.Flag.NONE, 5)
# another byte, than stop
data += dev.i2cMaster_ReadEx(slave, ft4222.I2CMaster.Flag.STOP, 1)

GPIO

import time
import ft4222
from ft4222.GPIO import Dir, Port, Output

# open device with default description 'FT4222 A'
dev = ft4222.openByDescription('FT4222 A')

# use GPIO2 as gpio (not suspend out)
dev.setSuspendOut(False)
# use GPIO3 as gpio (not wakeup)
dev.setWakeUpInterrupt(False)

# init GPIO2 as output
dev.gpio_Init(gpio2 = Dir.OUTPUT)

# generate a square wave signal with GPIO2
while True:
    dev.gpio_Write(Port.P2, output)
    output = not output
    time.sleep(0.1)

SPI Master and GPIO

The gpio used in this example indicate the duration of the whole spi transfer and is not used as chip/slave select.

import ft4222
from ft4222.SPI import Cpha, Cpol
from ft4222.SPIMaster import Mode, Clock, SlaveSelect
from ft4222.GPIO import Port, Dir
from time import sleep

# open 'device' with default description 'FT4222 A'
devA = ft4222.openByDescription('FT4222 A')
# and the second 'device' on the same chip
devB = ft4222.openByDescription('FT4222 B')

# init spi master
devA.spiMaster_Init(Mode.SINGLE, Clock.DIV_8, Cpol.IDLE_LOW, Cpha.CLK_LEADING, SlaveSelect.SS0)
# also use gpio
devB.gpio_Init(gpio0 = Dir.OUTPUT)

# generate data to send
data = bytes([x for x in range(256)]*4)

# set port0 1 (-> note this is *not* the spi chip select, the chip select (SS0) is generated by the spi core)
devB.gpio_Write(Port.P0, 1)

for _ in range(3):
    # write data in a single write
    devA.spiMaster_SingleWrite(data, True)
    # wait a short while
    sleep(0.5)

# set port0 0
devB.gpio_Write(Port.P0, 1)

Accessrights

Under Linux, the usb device is normally not accessibly by a normal user, therefor a udev rule is required. Create or extend /etc/udev/rules.d/99-ftdi.rules to contain the following text:

# FTDI's ft4222 USB-I2C Adapter
SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="601c", GROUP="plugdev", MODE="0666"

Requirements

Windows

MSVCR100.dll/MSVCP100.dll from Microsoft Visual C++ 2010 Redistributable Package need to be installed. Today, on most systems, these DLLs (or the package) should already be installed.

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

ft4222-1.12.0.tar.gz (3.3 MB view details)

Uploaded Source

Built Distributions

ft4222-1.12.0-cp313-cp313-win_amd64.whl (525.1 kB view details)

Uploaded CPython 3.13Windows x86-64

ft4222-1.12.0-cp313-cp313-win32.whl (430.0 kB view details)

Uploaded CPython 3.13Windows x86

ft4222-1.12.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (786.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

ft4222-1.12.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl (759.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

ft4222-1.12.0-cp312-cp312-win_amd64.whl (524.9 kB view details)

Uploaded CPython 3.12Windows x86-64

ft4222-1.12.0-cp312-cp312-win32.whl (430.3 kB view details)

Uploaded CPython 3.12Windows x86

ft4222-1.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (787.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

ft4222-1.12.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl (760.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

ft4222-1.12.0-cp311-cp311-win_amd64.whl (527.5 kB view details)

Uploaded CPython 3.11Windows x86-64

ft4222-1.12.0-cp311-cp311-win32.whl (433.0 kB view details)

Uploaded CPython 3.11Windows x86

ft4222-1.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (805.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

ft4222-1.12.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl (777.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

ft4222-1.12.0-cp310-cp310-win_amd64.whl (527.3 kB view details)

Uploaded CPython 3.10Windows x86-64

ft4222-1.12.0-cp310-cp310-win32.whl (433.2 kB view details)

Uploaded CPython 3.10Windows x86

ft4222-1.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (759.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

ft4222-1.12.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl (729.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

ft4222-1.12.0-cp39-cp39-win_amd64.whl (527.9 kB view details)

Uploaded CPython 3.9Windows x86-64

ft4222-1.12.0-cp39-cp39-win32.whl (433.9 kB view details)

Uploaded CPython 3.9Windows x86

ft4222-1.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl (761.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

ft4222-1.12.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl (731.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

File details

Details for the file ft4222-1.12.0.tar.gz.

File metadata

  • Download URL: ft4222-1.12.0.tar.gz
  • Upload date:
  • Size: 3.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ft4222-1.12.0.tar.gz
Algorithm Hash digest
SHA256 e688ab4b47bca3ca44a9d8c99d11f9b85c958a42f0d86c226b80d34d0bc8aecc
MD5 3049a233a807347095252fe97d24b175
BLAKE2b-256 1293b973929404f00494bdcc9fc0694913d7732b3e6050c9f587bdc414af4206

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: ft4222-1.12.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 525.1 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ft4222-1.12.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 57ddf8d61293835198d4ed71dcc0f7645740425cbed4c5c8db5185bf25ee6cf7
MD5 5146a835d94755112fcaff91ef664cfb
BLAKE2b-256 c7d13e739480b56fc2398806171132bcf0486232ac8c71f73036a28c2813f423

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp313-cp313-win32.whl.

File metadata

  • Download URL: ft4222-1.12.0-cp313-cp313-win32.whl
  • Upload date:
  • Size: 430.0 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ft4222-1.12.0-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 82a04418dafd6a8003660bf1cb49b481ce97683747c5055987a70d1f64cfb7e6
MD5 97f58f0c4e7a8112f2ca928074dc92ed
BLAKE2b-256 68c6e3f759ea0cdf999f2fbcba6730a76d7bbcfcbd1577d934f6af8da8797f10

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ft4222-1.12.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 53cba921d551693b7775f5cf45b3645519b04c841bd15d3044b20d52810078d1
MD5 8fe17ea7183388353869fe55791b6840
BLAKE2b-256 0d8a2faa0135c6e909ce8e5b03c037e0e7a194112d4da1e788f6e4c869b5b7b0

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ft4222-1.12.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 02bb6836031c6dc085610e2ab438d5f4870c55a3dd3df6bfac99a87c0c57d0b9
MD5 7fd7b57bcc651ae6ff243daf4880f351
BLAKE2b-256 ff059817ae6c35553ab09f10bcc803bfe04348f828b2ddf558182390be081809

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: ft4222-1.12.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 524.9 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ft4222-1.12.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3daa9ca4f206022d93cf7df01f54138357e6dd3485f426e248bb9be893db7722
MD5 45607bc99b1d17edbfb5f6d2b426ab38
BLAKE2b-256 e7e62888b36787952a0d89115eb4862ea25298f79630b12b6d2564113ccfb1b2

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp312-cp312-win32.whl.

File metadata

  • Download URL: ft4222-1.12.0-cp312-cp312-win32.whl
  • Upload date:
  • Size: 430.3 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ft4222-1.12.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 466fe506ed9990d5cea7d1a973b6e29554c56b82d24fd7f26d02dad7afd6ff7c
MD5 8f9ec7bb4b3d53d3f9b5c2ad43b5e88c
BLAKE2b-256 6bf3f47e24a798a6597c22b2c949921d2d9cd2e4652c9177589c706c68172a7c

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ft4222-1.12.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 486e1e1a5f8899abae36c50529cc5113945f39801b2e711cfe2d1696b5fcfa6c
MD5 1f9a84a58feec00c7e42747d0e44821e
BLAKE2b-256 ff2fb8929e7d0886129850a7cd33fc9927729d83153f97ef5ca36d199765249b

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ft4222-1.12.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d1051ccb307206a74731dd459c6f1c445d42bcf954a73eecbd4dc694d2ea6011
MD5 2b37f520b641ed2b43552f2f03ff5da5
BLAKE2b-256 63b47d8d33bbf88e26e276cd02225ef89b40f9457f5e8613a98239837c63b11b

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: ft4222-1.12.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 527.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ft4222-1.12.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2776198a226a363270f9fac17f8068a21550bb4e0d07efb43023e13f9b900a1e
MD5 c80eb85cf7094f3ae713b03377b5d768
BLAKE2b-256 50a5b16970db5c03aea907230ec9402530f1f3715b8d71018c284a978b802887

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp311-cp311-win32.whl.

File metadata

  • Download URL: ft4222-1.12.0-cp311-cp311-win32.whl
  • Upload date:
  • Size: 433.0 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ft4222-1.12.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 295fe03b150df06850d4c82770f1b314f628a92bb75a8b7a1e3d82793df80243
MD5 dddb8ab43e4fafadd9de815dcb5933e6
BLAKE2b-256 19e40764dd30665128ecbf98ac21c295af6629c16c62ab63182cdee23a2cde5d

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ft4222-1.12.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bcecd370b41d5467d332dc05255233fded7b231144b9d363fed1076117beeea5
MD5 bc63a41ae51bdd1cb6aa4ac1f410cc49
BLAKE2b-256 4f373516392e4c59ca5787d1af080255550dd24e79d09030112be78d23b29ca6

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ft4222-1.12.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 221567f2990188943d67597d5afdffa0b786e165a1dceab8031e0844c4a6be63
MD5 4ce0a393f22d9f8659a1291350dbfe5e
BLAKE2b-256 ff1d07a9d6fb28be649aa4ffc7d8ced9a4140c5a10090e8be5282ef189da8831

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: ft4222-1.12.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 527.3 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ft4222-1.12.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 67eeedaaefaa323065e853bebc2ac71705fea595fcc76e7d49d7db0a7dcc1d6a
MD5 3e81b622d11f5a6b80d9cfd05bc11dc4
BLAKE2b-256 a3865d793e655d257d15c45b1922fe45046121d89908dbb957d61f58dcbd84a7

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp310-cp310-win32.whl.

File metadata

  • Download URL: ft4222-1.12.0-cp310-cp310-win32.whl
  • Upload date:
  • Size: 433.2 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ft4222-1.12.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 5c4b7199d0e6c1f811adaa71d4a323050a60a716940d6c3e6c265d6786bd3840
MD5 7698b4971653fa021ada463c8a2b2a60
BLAKE2b-256 09ea75763762c0523e8c8142fa8ec15020f7e3937771682be80d37c27732188c

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ft4222-1.12.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4bc25e16081c775a039ff4d181f72658c4dc1e6aba2d4ba1b87e8ae3a250c991
MD5 1539bcc83cad728d88a61298bbadb0e6
BLAKE2b-256 d4070cbdaf14c433dfdf73cd619715451bc8a6c89c5adeb2a87bc8a0677d935f

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ft4222-1.12.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3cda15f7d968b2bf875a5907834870faa92e26bf42644bd2a3dc4c4e01e9b25d
MD5 0d678aede15d17778768815d203024a1
BLAKE2b-256 55866ff87ce0050cabf6397f8943b6accc7c3172153611dd398d1589c80496b2

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: ft4222-1.12.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 527.9 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ft4222-1.12.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6c9dc3213408dd08863f451beb115ea86d13f49b98c74367618db88115b482e0
MD5 9ac17182c3cd59ca3b174e7e8bc83989
BLAKE2b-256 e4577f143020bd51f2c8f72f61d2de69341f376cb00a0ed318a09ac758c26a4b

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp39-cp39-win32.whl.

File metadata

  • Download URL: ft4222-1.12.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 433.9 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ft4222-1.12.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 d685404c4b384e9ff6c43415be72f0c291b007fe7446010685ee7b928637f167
MD5 4b5a6822e62c8752dde5bb190cd33923
BLAKE2b-256 4ee2071d5ef87e04258cb546908900b4a5253cd9fe83be769bda362f4aad6477

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ft4222-1.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ad4316d1de0d9176ad5635c2d9b4cd3c4397a9ec91b2df20a1fd9f2b5f08d642
MD5 a8708d6d445e0d42635fe438deb4b7aa
BLAKE2b-256 3966ae0abc203bf7b12d479962781ecdd02cb97cabe4f56ed874d7f678cf1e2c

See more details on using hashes here.

File details

Details for the file ft4222-1.12.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ft4222-1.12.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 80eba901ad9f78f0745df4692ff51bf3acd5ef6d984fdb46938791f3e6c185ff
MD5 4073c2e1fb3efa419998a7473fe31ca4
BLAKE2b-256 71eae2c89969746cbe2736665cf7b1b353923ae7fe2bc058e3b4005078fd99b5

See more details on using hashes here.

Supported by

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