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.
Master.cpp
- Committer:
- Sparker
- Date:
- 2013-11-18
- Revision:
- 33:2a96d2e00b46
- Parent:
- 10:e52a6e1bbb48
File content as of revision 33:2a96d2e00b46:
// Reply to a SPI master as slave #include "mbed.h" SPISlave device(p5, p6, p7, p8); // mosi, miso, sclk, ssel 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 } } }