Downloads data from a raw SD card from a SEDS flight
Dependencies: SDFileSystem mbed
Revision 0:20fa3d43f1e7, committed 2014-06-13
- Comitter:
- richardemeadows
- Date:
- Fri Jun 13 14:50:47 2014 +0000
- Commit message:
- Initial Commit
Changed in this revision
diff -r 000000000000 -r 20fa3d43f1e7 SDFileSystem.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDFileSystem.lib Fri Jun 13 14:50:47 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/SDFileSystem/#7b35d1709458
diff -r 000000000000 -r 20fa3d43f1e7 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jun 13 14:50:47 2014 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" +#include "SDFileSystem.h" + +SDFileSystem sd(p5, p6, p7, p8, "sd"); // MOSI, MISO, SCLK, SSEL +DigitalOut myled(LED1); + +int main() { + printf("Starting download...\r\n"); + + sd.disk_initialize(); + + uint8_t buffer[0x200]; + sd.disk_read(buffer, 0); + + int block_count = ((uint32_t*)buffer)[0]; + printf("%d blocks to download...\r\n\r\n", block_count); + + char command; + printf("\r\nPress 'd' to download, 'c' to clear:\r\n"); + scanf("%c", &command); + + if (command == 'd') { + for (int i = 1; i < block_count; i++) { + sd.disk_read(buffer, i); + printf("%s\r", (char*)buffer); + } + } else if (command == 'c') { + printf("\r\nClearing first sector...\r\n"); + ((uint32_t*)buffer)[0] = 0; + sd.disk_write(buffer, 0); + } +} \ No newline at end of file
diff -r 000000000000 -r 20fa3d43f1e7 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jun 13 14:50:47 2014 +0000 @@ -0,0 +1,1 @@ +http://world3.dev.mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43 \ No newline at end of file