Inkplate-Arduino-library
Inkplate-Arduino-library copied to clipboard
Using SPIFFS and Inkplate.h does not work
If I use Inkplate.h and FS/SPIFFS in the same sketch, like this
#include "Inkplate.h" // Include Inkplate library to the sketch #include "FS.h" #include "SPIFFS.h"
I get a namespace clash error:
../Arduino/libraries/InkplateLibrary/src/include/../libs/SdFat/FatLib/ArduinoFiles.h:122:7: error: redefinition of 'class fs::File'
class File : public FatFile, public Stream {
How can I use SPIFFS and display related functions in the same sketch?
Can you please provide the code in question?
The bug is probably beacuse there is a class with the same name in the Inkplate library, I'll add a define or something where you can make the compiler ignore it.
#include "Inkplate.h"
#include "SPIFFS.h"
void setup() { }
void loop() { }
=>
In file included from ../Library/Arduino15/packages/Croduino_Boards/hardware/Inkplate/1.0.1/libraries/SPIFFS/src/SPIFFS.h:17:0,
from ../Documents/Arduino/test/test.ino:2:
../Library/Arduino15/packages/Croduino_Boards/hardware/Inkplate/1.0.1/libraries/FS/src/FS.h:118:11: error: 'File' is already declared in this scope
using fs::File;
SPIFFS and Inkplate.h are still not useable together. Is this a conflict with the SD library similar to the conversation in this thread?
Found a solution here for the conflict between File class defined in FS.h and SD that does not require any changes to the Inkplate library.
As shared by luc-github there is a define for this to be used before header call in the Arduino sketch:
#define FS_NO_GLOBALS #include <FS.h>
then you must add namespace fs for SPIFFS objects like
fs::File currentfile = SPIFFS.open("/myfile.txt", "r");
but for SD no need :
File textfile = SD.open("/myfile.txt", FILE_READ);
This resolves the conflict
Found a solution here for the conflict between File class defined in FS.h and SD that does not require any changes to the Inkplate library.
As shared by luc-github there is a define for this to be used before header call in the Arduino sketch:
#define FS_NO_GLOBALS #include <FS.h>then you must add namespace fs for SPIFFS objects like
fs::File currentfile = SPIFFS.open("/myfile.txt", "r");but for SD no need :File textfile = SD.open("/myfile.txt", FILE_READ);This resolves the conflict
Thank you for this! It ended up being the first useful result in my search for an answer to this problem.
The issue is closed because there is no more activity