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.
Revision 0:6cab1404a6db, committed 2013-12-10
- Comitter:
- cillino
- Date:
- Tue Dec 10 21:22:06 2013 +0000
- Commit message:
- SPI slave test.
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 Dec 10 21:22:06 2013 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+
+DigitalOut red_led( LED_RED );
+//DigitalOut green_led ( LED_GREEN );
+DigitalOut ss( PTD0 );
+
+
+int main() {
+
+ SPI spi_master( PTD2, PTD3, PTD1 );
+ spi_master.format( 8, 1 );
+ spi_master.frequency( 100000 );
+ ss = 1;
+
+ //red_led = 1;
+ //green_led = 1;
+
+
+ uint8_t sent = 0;
+
+ while(1) {
+ ss = 0;
+
+ spi_master.write( sent );
+ int rcvd = spi_master.write( 0x55 );
+
+ ss = 1;
+
+
+ if( rcvd != sent ){
+ red_led = 0;
+ while(1){};
+ }
+ else{
+ red_led = 1;
+ }
+
+ sent++;
+
+ wait(0.2);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Dec 10 21:22:06 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f \ No newline at end of file