demo
Dependencies: mbed SD_DISCO_F746NG BSP_DISCO_F746NG
Revision 4:12fc2f759b2e, committed 2019-06-04
- Comitter:
- phungductung
- Date:
- Tue Jun 04 09:07:12 2019 +0000
- Parent:
- 3:33086de19b14
- Commit message:
- SPKT;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 33086de19b14 -r 12fc2f759b2e main.cpp --- a/main.cpp Fri Jun 09 08:35:40 2017 +0000 +++ b/main.cpp Tue Jun 04 09:07:12 2019 +0000 @@ -2,10 +2,6 @@ #include "SD_DISCO_F746NG.h" SD_DISCO_F746NG sd; - -DigitalOut led_green(LED1); -DigitalOut led_red(LED2); - Serial pc(USBTX, USBRX); #define BLOCK_START_ADDR 0 /* Block start address */ @@ -24,31 +20,28 @@ int main() { uint8_t SD_state = MSD_OK; - pc.printf("\n\nuSD example start:\n"); - led_red = 0; - + pc.printf("\n\nuSD start:\n\r"); SD_state = sd.Init(); if(SD_state != MSD_OK){ if(SD_state == MSD_ERROR_SD_NOT_PRESENT){ - pc.printf("SD shall be inserted before running test\n"); + pc.printf("xin gan the SD truoc khi test\n\r"); } else { - pc.printf("SD Initialization : FAIL.\n"); + pc.printf("Khoi tao the SD: FAIL.\n\r"); } - pc.printf("SD Test Aborted.\n"); + pc.printf("Kiem tra the SD bi huy bo.\n\r"); } else { - pc.printf("SD Initialization : OK.\n"); - + pc.printf("Khoi tao the SD: OK.\n\r"); SD_state = sd.Erase(BLOCK_START_ADDR, (BLOCK_START_ADDR + NUM_OF_BLOCKS - 1)); /* Wait until SD card is ready to use for new operation */ while(sd.GetCardState() != SD_TRANSFER_OK){ } if (SD_state != MSD_OK){ - pc.printf("SD ERASE : FAILED.\n"); - pc.printf("SD Test Aborted.\n"); + pc.printf("Xoa the SD: FAILED.\n\r"); + pc.printf("Kiem tra the SD bi huy bo.\n\r"); } else { - pc.printf("SD ERASE : OK.\n"); - + pc.printf("Xoa the SD: OK.\n\r"); + /* Fill the buffer to write */ Fill_Buffer(aTxBuffer, BUFFER_WORDS_SIZE, 0x2300); @@ -58,27 +51,26 @@ } if (SD_state != MSD_OK){ - pc.printf("SD WRITE : FAILED.\n"); - pc.printf("SD Test Aborted.\n"); + pc.printf("Ghi du lieu len the SD: FAILED.\n\r"); + pc.printf("Kiem tra the SD bi huy bo.\n\r"); } else { - pc.printf("SD WRITE : OK.\n"); - + pc.printf("Ghi du lieu len the SD: OK.\n\r"); SD_state = sd.ReadBlocks(aRxBuffer, BLOCK_START_ADDR, NUM_OF_BLOCKS, 10000); /* Wait until SD card is ready to use for new operation */ while(sd.GetCardState() != SD_TRANSFER_OK){ } if (SD_state != MSD_OK){ - pc.printf("SD READ : FAILED.\n"); - pc.printf("SD Test Aborted.\n"); + pc.printf("Doc the SD: FAILED.\n\r"); + pc.printf("Kiem tra the SD bi huy bo.\n\r"); } else { - pc.printf("SD READ : OK.\n"); + pc.printf("Doc the SD: OK.\n\r"); if(Buffercmp(aTxBuffer, aRxBuffer, BUFFER_WORDS_SIZE) > 0){ - pc.printf("SD COMPARE : FAILED.\n"); - pc.printf("SD Test Aborted.\n"); + pc.printf("So sanh the SD: FAILED.\n\r"); + pc.printf("Kiem tra the SD bi huy bo.\n\r"); } else { - pc.printf("SD Test : OK.\n"); - pc.printf("SD can be removed.\n"); + pc.printf("Kiem tra the SD: OK.\n\r"); + pc.printf("Co the go bo the SD.\n\r"); } } } @@ -130,3 +122,4 @@ return 0; } +