-
Notifications
You must be signed in to change notification settings - Fork 8
SPI Sample
aushacker edited this page Feb 14, 2019
·
2 revisions
int clockRate = 1000000;
Device[] devices = FTDIInterface.getDevices();
if (devices.length == 0) {
// Error handling
}
Device dev = devices[0];
Spi spi = new Spi(dev, clockRate, SpiMode.M0, false);
spi.open();
// Write a single byte to the SPI bus
byte[] result = spi.transactReadWrite(new byte[] { (byte) 0xA5 });
spi.close();