spi test slave

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
AndyTran
Date:
Mon Dec 07 04:10:11 2015 +0000
Commit message:
spi_test

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Dec 07 04:10:11 2015 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+
+SPISlave slave (p11,p12,p13,p14);
+RawSerial pc(USBTX, USBRX);
+
+int main() {
+    while (true) {
+    pc.baud (921600);
+    slave.format(10, 3);
+    slave.frequency(10000000);
+    slave.reply(0x00);
+    int check = slave.receive();
+    pc.printf("receive = %d\n\r",check);
+    if(check==1)
+    {
+        int mes = slave.read();
+        pc.printf("%d\n\r",mes);
+    }
+    }
+    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Dec 07 04:10:11 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/165afa46840b
\ No newline at end of file