SPI Class --Looking for information -- | Thales IoT Developer Community
November 15, 2014 - 3:05pm, 2693 views
Hello,
I am working with TC65i.I need to use the SPI class --SpiConnection.I did not find any information in order to use this class.I have read that is very similar to I2C Connection.
Open I2C connection and data streams: i2cConnection cc = (I2cBusConnection) Connector.open("i2c:0;baudrate=100"); int baudrate = cc.getBaudRate(); InputStream inStream = cc.openInputStream(); OutputStream outStream = cc.openOutputStream(); // Write Transfer Frame, where a = message ID, AE = Slave Address and write // request: String data = "<aAE000102030405060708090A0B0C0E0F>"; outStream.write(data.getBytes(), 0, data.length()); outStream.flush()
So is this OK? --> spiConnection cc = (spiBusConnection) Connector.open("i2c:0;baudrate=100");
Would you please point me into the right direction to find some information in order to use this class?
Regards.
GF
Hi Foxmain,
You should find similar description and example as for i2c in the Java API SpiConnection interface.
To open SPI connection you will find something similar to this:
SpiConnection cc = (SpiConnection) Connector.open("spi:0;baudrate=100;clockMode=1");
If you are new to these protocols I think that the best point to start will be AT commands specification document.
You will find there some more information than in Java API and it will be easier to understand how these protocols are working when you try with AT commands first. When you will have a working communication for AT command interface it will be easier to implement it in Java.
Best regards,
Bartłomiej
Hi Bartłomiej,
Thanks for the tip!
Regards,
GF