Owen Jakob / Mbed 2 deprecated spiplzwork

Dependencies:   mbed

Revision:
0:55a8e24bdaf9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Nov 20 14:40:43 2019 +0000
@@ -0,0 +1,14 @@
+#include "mbed.h"
+#include <SPISlave.h>
+
+SPISlave device(D11, D12, D13, D8);
+int main() {
+    device.reply(0x00);              // Prime SPI with first reply
+    while(1) {
+        if(device.receive()) {
+            int v = device.read();   // Read byte from master
+            v = (v + 1) % 0x100;     // Add one to it, modulo 256
+            device.reply(v);         // Make this the next reply
+        }
+    }
+}
\ No newline at end of file