Use setClockSpeed to increase SPI clock speed

This is only available in newer version of the API. It can be downloaded here: http://www.intel.com/support/edison/sb/CS-035180.htm and can both be used with the Edison and the Galileo
Note that I tried to set the clock rate higher than 12 MHz, but it did not work
This commit is contained in:
Kristian Sloth Lauszus 2015-03-19 21:20:06 +01:00
parent 42a26346fa
commit 4e80db2b3f

View file

@ -51,7 +51,11 @@ public:
#if defined(__MIPSEL__) #if defined(__MIPSEL__)
SPI.setClockDivider(1); SPI.setClockDivider(1);
#elif defined(__ARDUINO_X86__) #elif defined(__ARDUINO_X86__)
SPI.setClockDivider(SPI_CLOCK_DIV2); // This will set the SPI frequency to 8MHz - it could be higher, but it is not supported in the API #ifdef SPI_CLOCK_1M // Hack used to check if setClockSpeed is available
SPI.setClockSpeed(12000000); // The MAX3421E can handle up to 26MHz, but in practice this was the maximum that I could reliably use
#else
SPI.setClockDivider(SPI_CLOCK_DIV2); // This will set the SPI frequency to 8MHz - it could be higher, but it is not supported in the old API
#endif
#else #else
SPI.setClockDivider(4); // Set speed to 84MHz/4=21MHz - the MAX3421E can handle up to 26MHz SPI.setClockDivider(4); // Set speed to 84MHz/4=21MHz - the MAX3421E can handle up to 26MHz
#endif #endif