You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 5 години
преди 5 години
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Simple test of Unicode file name.
  2. // Note: Unicode is only supported by the SdExFat class.
  3. // No exFAT functions will be defined for char* paths.
  4. // The SdFs class cannot be used.
  5. #include "SdFat.h"
  6. #if USE_EXFAT_UNICODE_NAMES
  7. // SDCARD_SS_PIN is defined for the built-in SD on some boards.
  8. #ifndef SDCARD_SS_PIN
  9. const uint8_t SD_CS_PIN = SS;
  10. #else // SDCARD_SS_PIN
  11. // Assume built-in SD is used.
  12. const uint8_t SD_CS_PIN = SDCARD_SS_PIN;
  13. #endif // SDCARD_SS_PIN
  14. // Use SPI, SD_CS_PIN, SHARED_SPI, FULL_SPEED.
  15. #define SD_CONFIG SdSpiConfig(SD_CS_PIN)
  16. SdExFat sd;
  17. ExFile file;
  18. void setup() {
  19. Serial.begin(9600);
  20. while (!Serial) {
  21. yield();
  22. }
  23. Serial.println("Type any character to begin");
  24. while (!Serial.available()) {
  25. yield();
  26. }
  27. if (!sd.begin(SD_CONFIG)) {
  28. sd.initErrorHalt(&Serial);
  29. }
  30. if (!file.open(u"Euros \u20AC test.txt", FILE_WRITE)) {
  31. Serial.println("file.open failed");
  32. return;
  33. }
  34. file.println("This is not Unicode");
  35. file.close();
  36. Serial.println("Done!");
  37. }
  38. void loop() {
  39. }
  40. #else // USE_EXFAT_UNICODE_NAMES
  41. #error USE_EXFAT_UNICODE_NAMES must be nonzero in SdFat/src/ExFatLib/ExFatCongfig.h
  42. #endif // USE_EXFAT_UNICODE_NAMES