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
Fork of SPI_master_lpc11u53 by
Revision 0:244a4a925723, committed 2015-03-18
- Comitter:
- armdran
- Date:
- Wed Mar 18 08:31:07 2015 +0000
- Child:
- 1:4445caa57b32
- Commit message:
- simple request / response works
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 Wed Mar 18 08:31:07 2015 +0000
@@ -0,0 +1,43 @@
+#include "mbed.h"
+
+//SPI Master
+
+SPI spi(p25, p28, p29); // mosi, miso, sclk
+Serial pc(USBTX, USBRX);
+DigitalOut led(LED1);
+DigitalOut cs(p24);
+
+int main() {
+
+ spi.format(8,0); //not usefull results
+
+ spi.frequency(1000000);
+ uint8_t i = 0;
+
+ while(1) {
+
+ cs = 0;
+ wait_ms(10);
+ uint8_t dummy_response = spi.write(i);
+ wait_ms(10);
+ cs = 1;
+
+ led = 1;
+ wait(2);
+ led = 0;
+
+ cs = 0;
+ wait_ms(10);
+ uint8_t response = spi.write(0xFF);
+ wait_ms(10);
+ cs = 1;
+
+ pc.printf("instruction: 0x%X; dummy_response = 0x%X; response = 0x%X\r\n", i, dummy_response, response);
+
+ led = 1;
+ wait(2);
+ led = 0;
+ i++;
+ }
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 18 08:31:07 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/7e07b6fb45cf \ No newline at end of file
