This is an [embedded-hal] implementation for the FTDI chips that can use various drivers including [libftd2xx] and [ftdi-rs].
This enables development of embedded device drivers without the use of a microcontroller. The FTDI devices interface with PC via USB, and provide a multi-protocol synchronous serial engine to interface with most GPIO, SPI, I2C embedded devices.
Note: This is strictly a development tool. The crate contains runtime borrow checks and explicit panics to adapt the FTDI device into the [embedded-hal] traits.
toml
[dependencies.ftdi-embedded-hal]
version = "0.11"
features = ["libftd2xx-static"]
Communicate with SPI devices using [ftdi-rs] driver: ```rust use ftdiembeddedhal as hal;
let device = ftdi::findbyvid_pid(0x0403, 0x6010) .interface(ftdi::Interface::A) .open()?;
let hal = hal::FtHal::initfreq(device, 3000_000)?; let spi = hal.spi()?; ```
Communicate with SPI devices using [libftd2xx] driver: ```rust use ftdiembeddedhal as hal;
let device = libftd2xx::Ft2232h::with_description("Dual RS232-HS A")?;
let hal = hal::FtHal::initfreq(device, 3000_000)?; let spi = hal.spi()?; ```
Communicate with I2C devices using [ftdi-rs] driver: ```rust use ftdiembeddedhal as hal;
let device = ftdi::findbyvid_pid(0x0403, 0x6010) .interface(ftdi::Interface::A) .open()?;
let hal = hal::FtHal::initfreq(device, 400000)?; let i2c = hal.i2c()?; ```
Communicate with I2C devices using [libftd2xx] driver: ```rust use ftdiembeddedhal as hal;
let device = libftd2xx::Ft232h::with_description("Single RS232-HS")?;
let hal = hal::FtHal::initfreq(device, 400000)?; let i2c = hal.i2c()?; ```
Control GPIO pins using [libftd2xx] driver: ```rust use ftdiembeddedhal as hal;
let device = libftd2xx::Ft232h::with_description("Single RS232-HS")?;
let hal = hal::FtHal::init_default(device)?; let gpio = hal.ad6(); ```
Control GPIO pins using [ftdi-rs] driver: ```rust use ftdiembeddedhal as hal;
let device = ftdi::findbyvid_pid(0x0403, 0x6010) .interface(ftdi::Interface::A) .open()?;
let hal = hal::FtHal::init_default(device)?; let gpio = hal.ad6(); ```