SenseSemi / Mbed 2 deprecated SPI_slave

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
suhasini
Date:
Fri Jul 29 10:06:50 2016 +0000
Commit message:
SPI slave using FRDM KL25Z

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	Fri Jul 29 10:06:50 2016 +0000
@@ -0,0 +1,23 @@
+// Reply to a SPI master as slave
+ 
+ #include "mbed.h"
+ 
+ SPISlave device(PTD2, PTD3, PTD1, PTD0); // mosi, miso, sclk, ssel
+ Serial pc(USBTX,USBRX);
+
+ 
+ int main() {
+     pc.baud(115200);
+     int v=0;
+     pc.printf("read the data");
+ //   device.reply(0x00);              // Prime SPI with first reply
+       while(1) {
+         if(device.receive()) {
+             v = device.read();   // Read byte from master
+             pc.printf("read the data %d",v);
+             v=0;
+             //v = (v + 1) % 0x100;     // Add one to it, modulo 256
+             //device.reply(v);         // Make this the next reply
+         }
+     }
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Jul 29 10:06:50 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/7e07b6fb45cf
\ No newline at end of file