slave.receive()が動作しない

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
moo
Date:
Tue Oct 18 20:18:10 2016 +0000
Commit message:
SPI_Test2

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
diff -r 000000000000 -r 8a5fd6497727 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Oct 18 20:18:10 2016 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+SPI mst(p11, p12, p13);
+DigitalOut cs(p14);
+SPISlave slv(p5, p6, p7, p8);
+ 
+int main() {
+    mst.frequency(19200);
+    mst.format(8,3);
+    slv.frequency(19200);
+    slv.format(8,3);
+    pc.printf("start\r\n");
+
+    cs = 0;
+    for (int i=0; i<0xff; ++i) {
+        mst.write(i);
+//        if (slv.receive()) {    // これが1にならない
+            int v = slv.read();
+            pc.printf("%02x  ",v);
+//        }
+        wait(0.1);
+    }
+}
diff -r 000000000000 -r 8a5fd6497727 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Oct 18 20:18:10 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3
\ No newline at end of file