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
Diff: main.cpp
- Revision:
- 1:4445caa57b32
- Parent:
- 0:244a4a925723
- Child:
- 2:52f588020826
diff -r 244a4a925723 -r 4445caa57b32 main.cpp
--- a/main.cpp Wed Mar 18 08:31:07 2015 +0000
+++ b/main.cpp Wed Mar 18 14:28:09 2015 +0000
@@ -10,34 +10,38 @@
int main() {
spi.format(8,0); //not usefull results
-
spi.frequency(1000000);
- uint8_t i = 0;
-
+ uint8_t i;
+ int j = 0;
+ uint8_t fail;
+ uint8_t success;
+ int pause = 1;
+
while(1) {
+ fail = 0;
+ success = 0;
+
+ for (i = 0; i < 32; i++) {
- cs = 0;
- wait_ms(10);
- uint8_t dummy_response = spi.write(i);
- wait_ms(10);
- cs = 1;
+ cs = 0;
+ spi.write(i);
+ cs = 1;
+ cs = 0;
+ uint8_t response = spi.write(0xFF);
+ cs = 1;
+
+ if(response == i + 0x10) {
+ success++;
+ } else {
+ fail++;
+ }
+
+ }
- 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++;
+ pc.printf("%d: fails: %d, success: %d\r\n",j++ , fail, success);
+ wait(.5);
+
}
+
}
\ No newline at end of file