Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Revision 0:794f7dd0a8ef, committed 2016-07-29
- 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