ExFatDbgDmp.ino 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "SdFat.h"
  2. #define DUMP_RAW 0
  3. #define DUMP_UPCASE 0
  4. const uint8_t CS_PIN = SS;
  5. //#define SD_CONFIG SdioConfig(FIFO_SDIO)
  6. #define SD_CONFIG SdSpiConfig(CS_PIN)
  7. SdExFat sd;
  8. #define error(s) sd.errorHalt(&Serial, F(s))
  9. void setup() {
  10. Serial.begin(9600);
  11. while (!Serial) {
  12. yield();
  13. }
  14. Serial.println(F("Type any character to begin"));
  15. while (!Serial.available()) {
  16. yield();
  17. }
  18. if (!sd.begin(SD_CONFIG)){
  19. error("begin failed");
  20. }
  21. #if DUMP_RAW
  22. sd.dmpSector(&Serial, 0);
  23. for (uint8_t i = 0; i < 24; i++) {
  24. sd.dmpSector(&Serial, 0X8000 + i);
  25. Serial.println();
  26. }
  27. return;
  28. #endif // DUMP_RAW
  29. ExFatFile root;
  30. if (!root.openRoot(&sd)) {
  31. error("openRoot failed");
  32. }
  33. sd.printDir(&Serial, &root);
  34. // startSector = 0, sectorCount = 1.
  35. sd.dmpFat(&Serial, 0, 1);
  36. sd.dmpBitmap(&Serial);
  37. sd.printVolInfo(&Serial);
  38. sd.checkUpcase(&Serial);
  39. #if DUMP_UPCASE
  40. sd.printUpcase(&Serial);
  41. #endif // DUMP_UPCASE
  42. // sd.dmpCluster(&Serial, 8, 0, 4);
  43. Serial.println("Done");
  44. }
  45. void loop() {
  46. // put your main code here, to run repeatedly:
  47. }