BaseExtCaseTest.ino 1014 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Program to test Short File Name character case flags.
  3. */
  4. #include <SPI.h>
  5. #include "SdFat.h"
  6. const uint8_t chipSelect = SS;
  7. SdFat sd;
  8. SdFile file;
  9. const char* name[] = {
  10. "low.low", "low.Mix", "low.UP",
  11. "Mix.low", "Mix.Mix", "Mix.UP",
  12. "UP.low", "UP.Mix", "UP.UP"
  13. };
  14. //------------------------------------------------------------------------------
  15. void setup() {
  16. Serial.begin(9600);
  17. // Wait for USB Serial
  18. while (!Serial) {
  19. yield();
  20. }
  21. Serial.println("type any character to start");
  22. while (!Serial.available()) {
  23. yield();
  24. }
  25. if (!sd.begin(chipSelect, SD_SCK_MHZ(50))) {
  26. Serial.println("begin failed");
  27. return;
  28. }
  29. for (uint8_t i = 0; i < 9; i++) {
  30. sd.remove(name[i]);
  31. if (!file.open(name[i], O_RDWR | O_CREAT | O_EXCL)) {
  32. sd.errorHalt(name[i]);
  33. }
  34. file.println(name[i]);
  35. file.close();
  36. }
  37. sd.ls(LS_DATE|LS_SIZE);
  38. Serial.println("Done");
  39. }
  40. //------------------------------------------------------------------------------
  41. void loop() {}