Thread: Java SPI comm
View Single Post
  #1   Spotlight this post!  
Unread 25-01-2012, 17:58
mitchellweb1 mitchellweb1 is offline
Registered User
AKA: Mitchell W
FRC #0190
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Acton, MA
Posts: 30
mitchellweb1 is an unknown quantity at this point
Re: Java SPI comm

Here is the SPI code that I have been working on for WPILibJ http://users.wpi.edu/~mwills/frc/ It is a little different than the current C implementation but I tried to make it so that it would be very easy to interact with multiple devices on the same SPI bus (the cRIO is only capable of one SPI bus). Please note that before you use the SPI device you must call SPIDevice.initBus (and you can call SPIDevice.freeBus to cleanup) with the clock, miso, and mosi pins.You can look at ADXL345_SPI.java for an example implementation of an SPIDevice (note this class does not contain the calls to initBus!). Please let me know if you get it working or have any problems or suggestions to improve the class. Eventually this code will be rolled into WPILibJ but it is still relatively untested.

--Mitchell