Huajian Huang / Mbed 2 deprecated TeensySlave_Nov16_public

Dependencies:   mbed

Fork of TeensySlave_Nov16 by Huajian Huang

Files at this revision

API Documentation at this revision

Comitter:
georgeHuang
Date:
Tue Nov 17 01:22:57 2015 +0000
Commit message:
teensySPISlave

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	Tue Nov 17 01:22:57 2015 +0000
@@ -0,0 +1,21 @@
+ // Reply to a SPI master as slave
+ 
+ #include "mbed.h"
+ int dataToMaster = 96;
+ //int MOSI=11;
+ //int MISO=12;
+ //int SCK=13;
+ //int CS=10;
+ SPISlave device(D11, D12, D13, D10); // mosi, miso, sclk, chipSelect
+ 
+ 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(dataToMaster);         // Make this the next reply
+         }
+     }
+ }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Nov 17 01:22:57 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11
\ No newline at end of file