Commit 24766731 authored by fxk8y's avatar fxk8y 🕷
Browse files

Begin developing FTDI CBUS LED blinky example script

parent 19189076
#!/usr/bin/env nix-shell
#!nix-shell -i python -p "python3.withPackages (p: with p; [pyftdi])" --pure
from time import sleep
from pyftdi.eeprom import FtdiEeprom
from pyftdi.ftdi import Ftdi, FtdiError
print('Hello, FTDI!')
ftdi = Ftdi()
# sanity check: device should support CBUS feature
# self.assertEqual(ftdi.has_cbus, True)
eeprom = FtdiEeprom()
# sanity check: device should have been configured for CBUS GPIOs
# self.assertEqual(eeprom.cbus_mask & 0b1001, 0b1001)
# configure CBUS0 and CBUS3 as output
ftdi.set_cbus_direction(0b1001, 0b1001)
# no input pin available
# self.assertRaises(FtdiError, ftdi.get_cbus_gpio)
frame = 0
while True:
ftdi.set_cbus_gpio(frame & 0b1001)
frame += 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment