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')
# 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.setWakeUpInterrut(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)
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"
Project details
Release history Release notifications | RSS feed
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.2.2.tar.gz
(2.3 MB
view hashes)
Built Distributions
ft4222-1.2.2-cp39-cp39-win_amd64.whl
(305.0 kB
view hashes)
ft4222-1.2.2-cp38-cp38-win_amd64.whl
(305.0 kB
view hashes)
ft4222-1.2.2-cp37-cp37m-win_amd64.whl
(302.8 kB
view hashes)
Close
Hashes for ft4222-1.2.2-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44a48e70c3bd129d5714a179fab29f50dbab15f081b62fe4ac79d920153e4483 |
|
MD5 | cda4560c4321e257720399bda1a8bf50 |
|
BLAKE2b-256 | e8d4c8a0d551633b6fed0e2fb6a60ab34317c4100e57504f76bdd1b6c2ef42ab |
Close
Hashes for ft4222-1.2.2-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d70d19f29d890ee0e210c1a2c81f7f054c4402807744ae91fb51fd2f9168e880 |
|
MD5 | 7ce556ec72924ee938630ba3ae1f71e7 |
|
BLAKE2b-256 | 053058c6780385f46c06513976c7efe274ac8736af6828af1a4f8245a2967e59 |
Close
Hashes for ft4222-1.2.2-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebe17f57435bbe4f72777c15a6d6842656fb83690da906873efba2c5110148c0 |
|
MD5 | 39177d009e829427bab1405213dcd2e2 |
|
BLAKE2b-256 | 0555bc5d7df5aac136ab782ac36151b7b852ae96e1dc4cb5a4828e12f1eaf77d |
Close
Hashes for ft4222-1.2.2-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b0065722413c17de232a79e1c595f0d8d0bc21f93bbf2296e9f32a9c9fd3f5e |
|
MD5 | e94419a4e9a27c13ecb9086db1989178 |
|
BLAKE2b-256 | e553b3bc24cd0553e0e761379f41aeb69cde15d5e276d84eb7779d085cb3582b |
Close
Hashes for ft4222-1.2.2-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acae8e33c7ccbe55bc9d1732050a18c8f6fe9462c381a3fdd0f1c6a71300a50d |
|
MD5 | c1779dbbe8709c8e316c6b75cb109638 |
|
BLAKE2b-256 | f9d75ac3f66548ad9bb1c01176483345349e61d35c569ec94ccceb74cad64119 |
Close
Hashes for ft4222-1.2.2-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb29130568d9a623373fc41a2041518eff0916736368f4ff0c4d4ec39a1e95c9 |
|
MD5 | 8e06ae6791752ff84898c0cd7e1d8cb3 |
|
BLAKE2b-256 | ff766ba4ac2237494d5318bd596d69a580a1936709cfec3968209ac8c82838aa |
Close
Hashes for ft4222-1.2.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec0388ee04eee7287464bcbb1329077698be0e2959f8b922da32365c1745299e |
|
MD5 | a6c0604e448fad3f85a6fbe0a89add3f |
|
BLAKE2b-256 | ee1cba57dfccce8b5e1879d1a6f853d5765d4acff9cc561aaecb795585506dae |