SdFat Adafruit Fork library V1.5.1 vs. V2.2.1

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
stratosfear
 
Posts: 18
Joined: Tue Dec 31, 2013 8:21 am

SdFat Adafruit Fork library V1.5.1 vs. V2.2.1

Post by stratosfear »

The code below is an abbreviated version of VolumeFreeSpace.ino modified for flash memory on an ItsyBitsy M0. It compiles and runs with the SdFat Adafruit Fork library V1.5.1. If the library is updated to V2.2.1, Arduino reports compile errors related to cout and vol(). Any suggestions other than staying with V1.5.1?

Code: Select all

#include "Adafruit_SPIFlash.h"
Adafruit_FlashTransport_SPI flashTransport(EXTERNAL_FLASH_USE_CS, EXTERNAL_FLASH_USE_SPI);
Adafruit_SPIFlash flash(&flashTransport);

// file system object
FatFileSystem fatfs;

static ArduinoOutStream cout(Serial);

void setup() {
  Serial.begin(115200);
  delay(5000);  //cheapshot delay
  printFreeSpace();
}

void loop() {
  // infinite loop!!!

}

void printFreeSpace() {
  File flashFile;   //file on flash
  flash.begin();
  fatfs.begin(&flash);

  cout << F("freeClusterCount() call time: ");
  uint32_t m = micros();
  uint32_t volFree = fatfs.vol()->freeClusterCount();
  cout << micros() - m << F(" micros\n");
  cout << F("freeClusters: ") <<  volFree << setprecision(3) << endl;
  float fs = 0.000512*volFree*fatfs.vol()->blocksPerCluster();
  cout << F("freeSpace: ") << fs << F(" MB (MB = 1,000,000 bytes)\n\n");
}

Locked
Please be positive and constructive with your questions and comments.

Return to “Itsy Bitsy Boards”