Can Adafruit FT232H board be used with Microsoft's System.Device.Gpio / Iot.Device.Bindings libraries? I've followed the instructions on https://learn.adafruit.com/circuitpython-on-any-computer-with-ft232h/windows to setup the driver with zadig and I can see libusbK listed in Device Manager. However, running this code throws an exception:
int pin = 18;
using var controller = new GpioController();
controller.OpenPin(pin, PinMode.Output);
bool ledOn = true;
while (true)
{
controller.Write(pin, ((ledOn) ? PinValue.High : PinValue.Low));
Thread.Sleep(1000);
ledOn = !ledOn;
}
Exception:
Unhandled exception. System.NotSupportedException: No GPIO controllers exist on this system.
at System.Device.Gpio.Drivers.Windows10Driver..ctor()
at System.Device.Gpio.GpioController.GetBestDriverForBoardOnWindows()
at System.Device.Gpio.GpioController.GetBestDriverForBoard()
at System.Device.Gpio.GpioController..ctor(PinNumberingScheme numberingScheme)
at System.Device.Gpio.GpioController..ctor()
at Program.<Main>$(String[] args) in C:\Users\....\source\repos\VS2022Staging\ConsoleApp1\Program.cs:line 10
C:\Users\....\source\repos\VS2022Staging\ConsoleApp1\bin\Debug\net6.0-windows10.0.17763.0\ConsoleApp1.exe (process 20168) exited with code -532462766.
Sure
However, you additionally need the
Iot.Device.Bindingsassembly, which contains drivers for a lot of different hardware.System.Device.Gpioonly contains the basic low-level drivers for linux as well as the interface specifications.Here's some sample code (from https://github.com/dotnet/iot/tree/main/src/devices/Ft232H)
The implementation is a wrapper around the mentioned FTDI custom api, but it has already been written for you.