Thanh navigation

Thứ Năm, 1 tháng 12, 2022

SPI/SDIO - MicroSD Card Module

 

ESP32 Handling Files with a MicroSD Card Module

Source: https://randomnerdtutorials.com/esp32-microsd-card-arduino/

There are two different libraries for the ESP32 (included in the Arduino core for the ESP32): the SD library and the SDD_MMC.h library.

If you use the SD library, you’re using the SPI controller. If you use the SDD_MMC library you’re using the ESP32 SD/SDIO/MMC controller. You can learn more about the ESP32 SD/SDIO/MMC driver.

    ESP32 Handle Files in microSD card Example Read and Write

 

Arduino program structure

Soure: https://github.com/arduino/ArduinoCore-avr/blob/master/cores/arduino/main.cpp

#include <Arduino.h>
// Declared weak in Arduino.h to allow user redefinitions.
int atexit(void (* /*func*/ )()) { return 0; }
// Weak empty variant initialization function.
// May be redefined by variant files.
void initVariant() __attribute__((weak));
void initVariant() { }
void setupUSB() __attribute__((weak));
void setupUSB() { }
int main(void)
{
    init();
    initVariant();
    #if defined(USBCON)
    USBDevice.attach();
    #endif
setup();
    for (;;) {
        loop();
        if (serialEventRun) serialEventRun();
    }
    return 0;
}