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.
Fork of SPI_NUCLEO_SLAVE by
Diff: main.cpp
- Revision:
- 1:d154278f2ca1
- Parent:
- 0:52f83e5addd7
--- a/main.cpp Tue Dec 05 10:33:22 2017 +0000
+++ b/main.cpp Wed Dec 06 08:46:12 2017 +0000
@@ -29,9 +29,9 @@
-#define SPI_DUMMY 0X00
+#define SPI_DUMMY 0X0000
#define SPI_CMD 0XADAD //Anything as a CMD code.
-#define SPI_FAULT 0xDD //Anything as a part of 16 bit as control byte
+#define SPI_FAULT 0xDD00 //Anything as a part of 16 bit as control byte
#ifdef _DEBUG
extern Serial pc;
@@ -49,10 +49,10 @@
/*This will be the float number we wish to transfer.
You can make a struct of multiple variable and send it in the same way*/
-typedef union SPI_Packet_t{
+typedef union {
float sensor;
byte SPI_Packet[sizeof(float)];
-};
+}SPI_Packet_t;
SPI_Packet_t packet;
int main()
@@ -93,7 +93,7 @@
}
else {
slave.reply(SPI_FAULT); //ERROR CODE
- slave.reply(SPI_DUMMY); //dummy ..skiped value
+ break;
}
}
}
