ZHCUD83 August 2025
initializeI2C(速度)
在 I2C 模式下初始化 FTDI。
| 速度 | 可以在 60k 到 3400k 之间。请注意,AFE20408 只能处理最高 400kbps 的速度 |
i2cWrite(从机器件地址,寄存器地址,寄存器数据)
向 EVM 发送 I2C 写入命令。
| 从器件地址 | 8 位从器件地址。此地址可使用 EVM 跳线进行配置。 |
| 寄存器地址 | 8 位寄存器地址 |
| 寄存器数据 | 16 位寄存器数据 |
i2cRead(从机器件地址,寄存器地址)
向 EVM 发送 I2C 读取命令。返回一个 16 位值。
| 从器件地址 | 8 位从器件地址。此地址可使用 EVM 跳线进行配置。 |
| 寄存器地址 | 8 位寄存器地址 |
示例:
ftdiObject = FtdiController() # initialize the FTDI
ftdiObject.getFtdiDeviceInfo() # Get FTDI info
ftdiObject.initializeI2C(400) # initialize I2C with 400kbps
# Write to slave address 0x40, register address 0x08, with data 0x0001
ftdiObject.i2cWrite(0x40, 0x08, 0x0001)
# Read back from slave address 0x40, register address 0x08, and print the data.
print(ftdiObject.i2cRead(0x40, 0x08))
ftdiObject.closeHandle() # close the FTDI when done.