Skip to content

Commit 38247b9

Browse files
author
Deepika
committed
Updated Readme example
1 parent e2dbe1f commit 38247b9

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

README.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -383,24 +383,32 @@ The following sample code illustrates how to use the sd-driver Block Device API:
383383
int main()
384384
{
385385
// call the SDBlockDevice instance initialisation method.
386-
if ( 0 != sd.init()) {
387-
printf("Init failed \n");
388-
return -1;
389-
}
390-
391-
// set the frequency
392-
if ( 0 != sd.frequency(5000000)) {
393-
printf("Error setting frequency \n");
394-
}
395-
396-
// Write some the data block to the device
397-
if ( 0 == sd.program(block, 0, 512)) {
398-
// read the data block from the device
399-
if ( 0 == sd.read(block, 0, 512)) {
400-
// print the contents of the block
401-
printf("%s", block);
402-
}
403-
}
386+
if ( 0 != sd.init()) {
387+
printf("Init failed \n");
388+
return -1;
389+
}
390+
printf("sd size: %llu\n", sd.size());
391+
printf("sd read size: %llu\n", sd.get_read_size());
392+
printf("sd program size: %llu\n", sd.get_program_size());
393+
printf("sd erase size: %llu\n", sd.get_erase_size());
394+
395+
// set the frequency
396+
if ( 0 != sd.frequency(5000000)) {
397+
printf("Error setting frequency \n");
398+
}
399+
400+
if ( 0 != sd.erase(0, sd.get_erase_size())) {
401+
printf("Error Erasing block \n");
402+
}
403+
404+
// Write some the data block to the device
405+
if ( 0 == sd.program(block, 0, 512)) {
406+
// read the data block from the device
407+
if ( 0 == sd.read(block, 0, 512)) {
408+
// print the contents of the block
409+
printf("%s", block);
410+
}
411+
}
404412
405413
// call the SDBlockDevice instance de-initialisation method.
406414
sd.deinit();

0 commit comments

Comments
 (0)