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:5fb6d5c13819, committed 2015-09-24
- Comitter:
- leonardoaraujosantos
- Date:
- Thu Sep 24 07:02:28 2015 +0000
- Commit message:
- Working on slave (With FPGA)
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 |
diff -r 000000000000 -r 5fb6d5c13819 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Sep 24 07:02:28 2015 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+/*
+ Gael board NUCLEO-F401RE SPI slave
+*/
+
+ //------------------------------------
+// Serial configuration (Put on hyperterminal or Putty)
+// 115200 bauds, 8-bit data, no parity
+//------------------------------------
+Serial serialIO(SERIAL_TX, SERIAL_RX);
+
+int main() {
+
+ // Configure the serial speed.
+ serialIO.baud(115200);
+ serialIO.printf("SPI Slave example with mbed!\r\n");
+
+ // Configure the SPI to 8-bits Mode 0, 5Mhz
+ SPISlave spiSlave(PA_7, PA_6, PA_5, PA_15); // mosi, miso, sclk, ssel
+ spiSlave.format(8,0);
+ spiSlave.frequency(5000000);
+ spiSlave.reply(191);
+
+ serialIO.printf("SPI Slave Waiting!\r\n");
+ while(1) {
+ wait_us(2);
+ if(spiSlave.receive())
+ {
+ serialIO.printf("Slave received: %d\r\n",spiSlave.read());
+ }
+ }
+}
+
\ No newline at end of file
diff -r 000000000000 -r 5fb6d5c13819 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Sep 24 07:02:28 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad \ No newline at end of file