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 raw_sd_card_write_raw by
Revision 4:003e6dfc288d, committed 2015-06-06
- Comitter:
- pradeepvk2208
- Date:
- Sat Jun 06 11:59:07 2015 +0000
- Parent:
- 3:d4bb1e13a897
- Commit message:
- dis is final
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d4bb1e13a897 -r 003e6dfc288d main.cpp --- a/main.cpp Sat Jun 06 11:46:02 2015 +0000 +++ b/main.cpp Sat Jun 06 11:59:07 2015 +0000 @@ -18,6 +18,7 @@ int initialise_card_v2(); int disk_initialize(); int disk_write(const uint8_t *, uint64_t); +int disk_read(uint8_t *, uint64_t); uint64_t sd_sectors(); uint64_t sectors; @@ -56,6 +57,10 @@ for(count_bro=0;count_bro<512;count_bro++) {buffer[count_bro]='a';} disk_write(buffer, 2); + uint8_t read_data[512]; + disk_read(read_data, 2); + for(count_bro=0;count_bro<512;count_bro++) + {printf("%c",buffer[count_bro]);} @@ -388,3 +393,14 @@ return 0; } +int disk_read(uint8_t *buffer, uint64_t block_number) { + // set read address for single block (CMD17) + if (cmd(17, block_number * cdv) != 0) { + return 1; + } + + // receive the data + read(buffer, 512); + return 0; +} +