Skip to content
Snippets Groups Projects
Commit 24766731 authored by fxk8y's avatar fxk8y :spider:
Browse files

Begin developing FTDI CBUS LED blinky example script

parent 19189076
No related branches found
No related tags found
No related merge requests found
#!/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()
ftdi.open_from_url('ftdi:///1')
# sanity check: device should support CBUS feature
# self.assertEqual(ftdi.has_cbus, True)
eeprom = FtdiEeprom()
eeprom.connect(ftdi)
# 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
sleep(0.1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment