ImageReader Library will not compiler ESP32 Feather

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
orenza
 
Posts: 3
Joined: Sat Oct 13, 2018 3:05 pm

ImageReader Library will not compiler ESP32 Feather

Post by orenza »

Hi,

I'm using the ImageReader example code (see below) to display images from an SD card. Hardware is an Adfruit ESP32 Feather and an Adafruit 1.44" Color TFT LCD Display with MicroSD Card breakout - ST7735R. I'm using PlatformIO (VScode).

No matter what I seem to try I get a compiler error which appears to suggest that flash_t was not declared in scope for Adafruit_FlashTransport_ESP32.cpp

Interestingly (maybe) when I try and compile using Arduino 1.8.15 IDE it works.

Conversely if I try the same code again on Arduino 2.0 Beta11 IDE it also fails with the same error message above that PlatformIO gives me.

I've searched the forums buy closest I've come across that's similar is this: espressif/arduino-esp32#4115 which doesn't work

Error:

Code: Select all

c:\Users\user\Documents\Arduino\libraries\Adafruit_SPIFlash\src\esp32\Adafruit_FlashTransport_ESP32.cpp: In member function 'SPIFlash_Device_t* Adafruit_FlashTransport_ESP32::getFlashDevice()':
c:\Users\user\Documents\Arduino\libraries\Adafruit_SPIFlash\src\esp32\Adafruit_FlashTransport_ESP32.cpp:54:3: error: 'esp_flash_t' was not declared in this scope
esp_flash_t const *flash = _partition->flash_chip;
^
c:\Users\user\Documents\Arduino\libraries\Adafruit_SPIFlash\src\esp32\Adafruit_FlashTransport_ESP32.cpp:55:36: error: 'flash' was not declared in this scope
_flash_device.manufacturer_id = (flash->chip_id >> 16);
^
Compilation error: Error: 2 UNKNOWN: exit status 1
Code:

Code: Select all

// Adafruit_ImageReader test for Adafruit ST7735 TFT Breakout for Arduino.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires three BMP files in root directory of SD card:
// rgbwheel.bmp, miniwoof.bmp
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.

#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SdFat.h> // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h> // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions

// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD

// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.

#define SD_CS 33 // SD card select pin
#define TFT_CS 14 // TFT select pin
#define TFT_DC 32 // TFT display/command pin
#define TFT_RST 15 // Or set to -1 and connect to Arduino RESET pin

#if defined(USE_SD_CARD)
SdFat SD; // SD card filesystem
Adafruit_ImageReader reader(SD); // Image-reader object, pass in SD filesys
#else
// SPI or QSPI flash filesystem (i.e. CIRCUITPY drive)
#if defined(SAMD51) || defined(NRF52840_XXAA)
Adafruit_FlashTransport_QSPI flashTransport(PIN_QSPI_SCK, PIN_QSPI_CS,
PIN_QSPI_IO0, PIN_QSPI_IO1, PIN_QSPI_IO2, PIN_QSPI_IO3);
#else
#if (SPI_INTERFACES_COUNT == 1)
Adafruit_FlashTransport_SPI flashTransport(SS, &SPI);
#else
Adafruit_FlashTransport_SPI flashTransport(SS1, &SPI1);
#endif
#endif
Adafruit_SPIFlash flash(&flashTransport);
FatFileSystem filesys;
Adafruit_ImageReader reader(filesys); // Image-reader, pass in flash filesys
#endif

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
Adafruit_Image img; // An image loaded into RAM
int32_t width = 0, // BMP image dimensions
height = 0;

void setup(void) {

ImageReturnCode stat; // Status from image-reading functions

Serial.begin(9600);
#if !defined(ESP32)
while(!Serial); // Wait for Serial Monitor before continuing
#endif

tft.initR(INITR_144GREENTAB); // Initialize screen

// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatFileSystem object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(10))) { // Breakouts require 10 MHz limit due to longer wires
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
Serial.println(F("OK!"));

// Fill screen blue. Not a required step, this just shows that we're
// successfully communicating with the screen.
tft.fillScreen(ST7735_BLUE);

// Load full-screen BMP file 'lily128.bmp' at position (0,0) (top left).
// Notice the 'reader' object performs this, with 'tft' as an argument.
Serial.print(F("Loading lily128.bmp to screen..."));
stat = reader.drawBMP("/lily128.bmp", tft, 0, 0);
reader.printStatus(stat); // How'd we do?

delay(5000); // Pause 5 seconds before moving on to loop()

}

void loop() {

}
Last edited by adafruit_support_mike on Fri Sep 10, 2021 9:16 pm, edited 1 time in total.
Reason: added CODE tags

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: ImageReader Library will not compiler ESP32 Feather

Post by adafruit_support_mike »

The type esp_flash_t is defined in the ESP32 standard packages:

https://github.com/espressif/esp-idf/bl ... h#L95-L107

PlatformIO and the Arduino 2.0 IDE may not have complete versions of those libraries.

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

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”