![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
FINAL PROJECT isn't it
Fork of ELEC351 by
Diff: SPI.cpp
- Revision:
- 53:71f59e195f06
- Child:
- 56:bc5345bc6650
diff -r 99915f5240b2 -r 71f59e195f06 SPI.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SPI.cpp Mon May 07 15:44:34 2018 +0000 @@ -0,0 +1,38 @@ +#include "SPI.hpp" +//File for SPI communication + + + +void SPI_INIT() +{ + + + /* + MOSI = Blue + MISO = White + SCLK = Yellow + Slave Select = Green + + */ + + + // Chip must be deselected + cs = 1; //Active Low + + // Setup the spi for 8 bit data, high steady state clock, + // second edge capture, with a 1MHz clock rate + spi.format(16,0); // 8 Data bits phase 0 polarity 0 + spi.frequency(1000000);//Output clock frequency 1Mhz + + // Select the device by seting chip select low + //cs = 0;//This is active after spi is set up + + // Send 0x8f, the command to read the WHOAMI register + //spi.write(0x8F); + + // Send a dummy byte to receive the contents of the WHOAMI register + //int whoami = spi.write(0x00); + //printf("WHOAMI register = 0x%X\n", whoami); + // Deselect the device + //cs = 1; +} \ No newline at end of file