Should f_findfirst be available when the define FF_USE_FIND is set?

xgarbxgarb
Posts: 6
Joined: Fri Jan 25, 2019 3:36 pm

Should f_findfirst be available when the define FF_USE_FIND is set?

Postby xgarbxgarb » Thu May 30, 2019 4:03 pm

I'm trying to build a directory lister using FatFs with VFS for an SD card reader.

I get an undefined reference error when I try to use f_findfirst even when I change the FF_USE_FIND define in ffconf.h

Should I be able to use f_findfirst in the Arduino IDE? Basic code below:

Code: Select all

#include "Arduino.h"
#include "driver/sdmmc_host.h"
#include "driver/sdmmc_defs.h"
#include "sdmmc_cmd.h"
#include "esp_vfs_fat.h"

static esp_err_t card_err;

void setup() {
  Serial.begin(115200);
  card_err = init_sdcard();

#ifdef FF_USE_FIND
  Serial.print("defined: ");
  Serial.println( FF_USE_FIND ); // shows 2 in the serial monitor
#endif

  FF_DIR* dp;
  FRESULT dj = f_opendir(dp, "/sdcard");

  FRESULT fr;
  FILINFO fno;

  fr = f_findfirst(dp, &fno, "", "*");  // errors with "undefined reference to `f_findfirst'"

  while (fr == FR_OK && fno.fname[0]) {
    printf("%s\n", fno.fname);
    fr = f_findnext(dp, &fno);
  }

  f_closedir(dp);
}

Who is online

Users browsing this forum: MSN [Bot] and 7 guests