Test 1678 SPI 8 FIFO

Dependencies:   mbed

Revision:
0:5c1439ae6776
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Dec 26 11:49:29 2014 +0000
@@ -0,0 +1,45 @@
+
+ #include "mbed.h"
+ DigitalOut led1(LED1);
+ 
+SPI spi(p5, p6, p7); // mosi, miso, sclk
+DigitalOut cs(p8);
+ 
+SPISlave device(p11, p12, p13, p14); // mosi, miso, sclk, ssel
+ 
+ int main() {
+    cs = 1;
+    spi.format(8,3);
+    device.format(8,3);
+    spi.frequency(1000000);
+    device.frequency(1000000);
+
+     led1 = 1;
+     while(1) {
+         wait(1);
+         led1 = !led1;
+         cs = 0;
+         spi.write(0x01);
+         spi.write(0x02);
+         spi.write(0x03);
+         spi.write(0x04);
+         spi.write(0x05);
+         spi.write(0x06);
+         spi.write(0x07);
+         spi.write(0x08);
+         cs = 1;   
+         
+         int d1 = device.read();
+         int d2 = device.read();
+         int d3 = device.read();
+         int d4 = device.read();
+         int d5 = device.read();
+         int d6 = device.read();
+         int d7 = device.read();
+         int d8 = device.read();
+         
+         printf("d1=%X d2=%X d3=%X d4=%X d5=%X d6=%X d7=%X d8=%X\r\n",
+          d1, d2, d3, d4, d5, d6, d7, d8);      
+         
+     }
+ }
\ No newline at end of file