from binascii import hexlify
from pyftdi.ftdi import Ftdi
from pyftdi.spi import SpiController,SpiGpioPort
#from pyftdi.gpio import GpioController
from sys import modules, stderr, stdout
import time
from array import array

def WriteFPGA(Slave,adress,value):

    Slave.write([0xAA], True, True)
    Slave.write([adress], True, True)
    Slave.write([value], True, True)

def WriteFPGA2(Slave,adress,value,Gpio):
    Gpio.write(0x1800)

    Gpio.write(0x1000)
    Slave.write([adress], True, True)
    gpio.write(0x1800)

    Gpio.write(0x1000)
    Slave.write([adress], True, True)
    Gpio.write(0x1800)

    Gpio.write(0x1000)
    Slave.write([value], True, True)
    Gpio.write(0x1800)

# Instanciate a SPI controller
spi = SpiController()
# Configure the first interface (IF/1) of the FTDI device as a SPI master
spi.configure('ftdi://ftdi:2232h/1',debug=0) 

slave = spi.get_port(cs=0, freq=1E6, mode=0)
#to get the maximun frequency possible on this link
print(spi.frequency_max)


results matching ""

    No results matching ""