diff --git a/library.json b/library.json index cadd8f0..e744be0 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "ESP-Google-Sheet-Client", - "version": "1.3.3", + "version": "1.3.4", "keywords": "communication, REST, esp32, esp8266, raspberrypi, arduino", "description": "Arduino Google Sheet REST client library for ESP8266, ESP32 and Raspberry Pi Pico (RP2040). This library allows devices to communicate with Google Sheet API to read, edit and delete the spreadsheets", "repository": { @@ -12,5 +12,5 @@ "email": "suwatchai@outlook.com" }], "frameworks": "arduino", - "platforms": "espressif32, espressif8266, raspberrypi" + "platforms": "espressif32, espressif8266, rp2040" } diff --git a/library.properties b/library.properties index 9ea7958..2a74ba5 100644 --- a/library.properties +++ b/library.properties @@ -1,6 +1,6 @@ name=ESP-Google-Sheet-Client -version=1.3.3 +version=1.3.4 author=Mobizt diff --git a/src/ESP_Google_Sheet_Client.cpp b/src/ESP_Google_Sheet_Client.cpp index cc5e84e..a6b1c26 100644 --- a/src/ESP_Google_Sheet_Client.cpp +++ b/src/ESP_Google_Sheet_Client.cpp @@ -1,9 +1,9 @@ /** - * Google Sheet Client, GS_Google_Sheet_Client.cpp v1.3.3 + * Google Sheet Client, GS_Google_Sheet_Client.cpp v1.3.4 * * This library supports Espressif ESP8266 and ESP32 MCUs * - * Created February 6, 2023 + * Created March 5, 2023 * * The MIT License (MIT) * Copyright (c) 2022 K. Suwatchai (Mobizt) @@ -137,7 +137,7 @@ bool GSheetClass::beginRequest(MB_String &req, host_type_t host_type) if (client && !client->connected()) { -#if defined(ESP8266) || defined(PICO_RP2040) +#if defined(ESP8266) || defined(MB_ARDUINO_PICO) if (host_type == host_type_sheet) client->ethDNSWorkAround(&config.spi_ethernet_module, (const char *)FPSTR("sheets.googleapis.com"), 443); else if (host_type == host_type_drive) @@ -195,7 +195,7 @@ void GSheetClass::setCert(const char *ca) { cert_updated = true; cert_addr = addr; -#if defined(ESP8266) || defined(PICO_RP2040) +#if defined(ESP8266) || defined(MB_ARDUINO_PICO) waitClockReady(); #endif } @@ -210,7 +210,7 @@ void GSheetClass::setCertFile(const char *filename, esp_google_sheet_file_storag { cert_updated = true; -#if defined(ESP8266) || defined(PICO_RP2040) +#if defined(ESP8266) || defined(MB_ARDUINO_PICO) waitClockReady(); #endif } @@ -244,7 +244,7 @@ bool GSheetClass::setSecure() if (!authMan.reconnect(client)) return false; -#if (defined(ESP8266) || defined(PICO_RP2040)) +#if (defined(ESP8266) || defined(MB_ARDUINO_PICO)) if (TimeHelper::getTime(&mb_ts, &mb_ts_offset) > GS_DEFAULT_TS) { config.internal.clock_rdy = true; diff --git a/src/ESP_Google_Sheet_Client.h b/src/ESP_Google_Sheet_Client.h index c6f50ee..81f0169 100644 --- a/src/ESP_Google_Sheet_Client.h +++ b/src/ESP_Google_Sheet_Client.h @@ -1,16 +1,16 @@ #ifndef ESP_GOOGLE_SHEET_CLIENT_VERSION -#define ESP_GOOGLE_SHEET_CLIENT_VERSION "1.3.3" +#define ESP_GOOGLE_SHEET_CLIENT_VERSION "1.3.4" #endif /** - * Google Sheet Client, ESP_Google_Sheet_Client.h v1.3.3 + * Google Sheet Client, ESP_Google_Sheet_Client.h v1.3.4 * * This library supports Espressif ESP8266 and ESP32 MCUs * - * Created February 6, 2023 + * Created March 5, 2023 * * The MIT License (MIT) - * Copyright (c) 2022 K. Suwatchai (Mobizt) + * Copyright (c) 2023 K. Suwatchai (Mobizt) * * * Permission is hereby granted, free of charge, to any person returning a copy of @@ -32,6 +32,7 @@ */ #include +#include "mbfs/MB_MCU.h" #ifndef ESP_Google_Sheet_Client_H #define ESP_Google_Sheet_Client_H diff --git a/src/ESP_Google_Sheet_Client_FS_Config.h b/src/ESP_Google_Sheet_Client_FS_Config.h index 24e8ea2..9a20288 100644 --- a/src/ESP_Google_Sheet_Client_FS_Config.h +++ b/src/ESP_Google_Sheet_Client_FS_Config.h @@ -2,6 +2,7 @@ #define ESP_GOOGLE_SHEET_CLIENT_FS_CONFIG_H_ #include +#include "mbfs/MB_MCU.h" /** * To use other flash file systems @@ -24,7 +25,7 @@ #endif #if defined(ESP32) || defined(ESP8266) #define DEFAULT_FLASH_FS SPIFFS -#elif defined(PICO_RP2040) +#elif defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_NANO_RP2040_CONNECT) #include #define DEFAULT_FLASH_FS LittleFS #endif @@ -42,7 +43,7 @@ #include #define DEFAULT_SD_FS SD #define CARD_TYPE_SD 1 -#elif defined(PICO_RP2040) +#elif defined(ARDUINO_ARCH_RP2040) && !defined(ARDUINO_NANO_RP2040_CONNECT) // Use SDFS (ESP8266SdFat) instead of SD #include #define DEFAULT_SD_FS SDFS diff --git a/src/GS_Const.h b/src/GS_Const.h index b0bef65..788ce71 100644 --- a/src/GS_Const.h +++ b/src/GS_Const.h @@ -25,6 +25,9 @@ #define GS_MIN_WIFI_RECONNECT_TIMEOUT 10 * 1000 #define GS_MAX_WIFI_RECONNECT_TIMEOUT 5 * 60 * 1000 +#include +#include "mbfs/MB_MCU.h" + #if defined(ESP32) && !defined(ESP_ARDUINO_VERSION) /* ESP32 core < v2.0.x */ #include #else @@ -258,7 +261,7 @@ struct gauth_token_signer_resources_t size_t signatureSize = 256; #if defined(ESP32) uint8_t *hash = nullptr; -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) char *hash = nullptr; #endif unsigned char *signature = nullptr; diff --git a/src/GS_Helper.h b/src/GS_Helper.h index 82ab8e0..c64ee49 100644 --- a/src/GS_Helper.h +++ b/src/GS_Helper.h @@ -1,9 +1,9 @@ #ifndef GS_HELPER_H #define GS_HELPER_H -#include "ESP_Google_Sheet_Client_FS_Config.h" - #include +#include "mbfs/MB_MCU.h" +#include "ESP_Google_Sheet_Client_FS_Config.h" #include #if !defined(__AVR__) @@ -14,7 +14,7 @@ #include "GS_Const.h" #if defined(ESP8266) #include -#elif defined(PICO_RP2040) +#elif defined(MB_ARDUINO_PICO) #include #include #endif @@ -69,10 +69,10 @@ namespace TimeHelper inline time_t getTime(uint32_t *mb_ts, uint32_t *mb_ts_offset) { uint32_t &tm = *mb_ts; -#if defined(ENABLE_EXTERNAL_CLIENT) || defined(PICO_RP2040) +#if defined(ENABLE_EXTERNAL_CLIENT) || defined(MB_ARDUINO_PICO) tm = *mb_ts_offset + millis() / 1000; -#if defined(PICO_RP2040) +#if defined(MB_ARDUINO_PICO) if (tm < time(nullptr)) tm = time(nullptr); #endif @@ -157,9 +157,9 @@ namespace TimeHelper #else -#if defined(ESP32) || defined(ESP8266) || defined(PICO_RP2040) +#if defined(ESP32) || defined(ESP8266) || defined(MB_ARDUINO_PICO) -#if defined(PICO_RP2040) +#if defined(MB_ARDUINO_PICO) NTP.begin("pool.ntp.org", "time.nist.gov"); NTP.waitSet(); diff --git a/src/GS_SDHelper.h b/src/GS_SDHelper.h index 70643c1..8b340d0 100644 --- a/src/GS_SDHelper.h +++ b/src/GS_SDHelper.h @@ -3,6 +3,7 @@ #define GS_SD_HELPER_H_ #include +#include "mbfs/MB_MCU.h" #include "ESP_Google_Sheet_Client.h" // If SD Card used for storage, assign SD card type and FS used in src/ESP_Google_Sheet_Client_FS_Config.h and @@ -18,7 +19,7 @@ #define SPI_CLOCK_IN_MHz 16 #elif defined(ESP8266) #define SPI_CS_PIN 15 -#elif defined(PICO_RP2040) +#elif defined(MB_ARDUINO_PICO) // Use SPI 1's SS (GPIO 13) port as CS for SPI #define SPI_CS_PIN PIN_SPI1_SS #endif @@ -37,7 +38,7 @@ SPIClass spi; SDFSConfig sdFSConfig(SPI_CS_PIN, SPI_HALF_SPEED); -#elif defined(PICO_RP2040) +#elif defined(MB_ARDUINO_PICO) /** Use Pico SPI 1 for SPI * MISO GPIO 12 @@ -102,7 +103,7 @@ bool SD_Card_Mounting() return true; } -#elif defined(PICO_RP2040) +#elif defined(MB_ARDUINO_PICO) Serial.print("\nMounting SD Card... "); diff --git a/src/auth/GAuthManager.cpp b/src/auth/GAuthManager.cpp index b7bdbfb..7f6d4da 100644 --- a/src/auth/GAuthManager.cpp +++ b/src/auth/GAuthManager.cpp @@ -1,9 +1,9 @@ /** - * Google Sheet Client, GAuthManager v1.0.1 + * Google Sheet Client, GAuthManager v1.0.2 * * This library supports Espressif ESP8266, ESP32 and Raspberry Pi Pico MCUs. * - * Created February 6, 2023 + * Created March 5, 2023 * * The MIT License (MIT) * Copyright (c) 2022 K. Suwatchai (Mobizt) @@ -30,6 +30,8 @@ #ifndef GAUTH_MANAGER_CPP #define GAUTH_MANAGER_CPP +#include +#include "mbfs/MB_MCU.h" #include "GAuthManager.h" GAuthManager::GAuthManager() @@ -185,7 +187,7 @@ time_t GAuthManager::getTime() bool GAuthManager::setTime(time_t ts) { -#if !defined(ESP_GOOGLE_SHEET_CLIENT_ENABLE_EXTERNAL_CLIENT) && (defined(ESP8266) || defined(ESP32) || defined(PICO_RP2040)) +#if !defined(ESP_GOOGLE_SHEET_CLIENT_ENABLE_EXTERNAL_CLIENT) && (defined(ESP8266) || defined(ESP32) || defined(MB_ARDUINO_PICO)) if (TimeHelper::setTimestamp(ts) == 0) { @@ -428,7 +430,7 @@ void GAuthManager::tokenProcessingTask() // flag set for valid time required bool sslValidTime = false; -#if defined(ESP8266) || defined(PICO_RP2040) +#if defined(ESP8266) || defined(MB_ARDUINO_PICO) // valid time required for SSL handshake using server certificate in ESP8266 if (config->cert.data != NULL || config->cert.file.length() > 0) sslValidTime = true; @@ -872,7 +874,7 @@ bool GAuthManager::createJWT() MemoryHelper::freeBuffer(mbfs, config->signer.hash); return false; } -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) config->signer.hash = MemoryHelper::createBuffer(mbfs, config->signer.hashSize); br_sha256_context mc; br_sha256_init(&mc); @@ -973,7 +975,7 @@ bool GAuthManager::createJWT() if (ret != 0) return false; -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) // RSA private key BearSSL::PrivateKey *pk = nullptr; Utils::idle(); diff --git a/src/auth/GAuthManager.h b/src/auth/GAuthManager.h index cc9bf72..9b615d1 100644 --- a/src/auth/GAuthManager.h +++ b/src/auth/GAuthManager.h @@ -1,9 +1,9 @@ /** - * Google Sheet Client, GAuthManager v1.0.1 + * Google Sheet Client, GAuthManager v1.0.2 * * This library supports Espressif ESP8266, ESP32 and Raspberry Pi Pico MCUs. * - * Created February 6, 2023 + * Created March 5, 2023 * * The MIT License (MIT) * Copyright (c) 2022 K. Suwatchai (Mobizt) @@ -28,7 +28,8 @@ */ #ifndef GAUTH_MANAGER_H #define GAUTH_MANAGER_H - +#include +#include "mbfs/MB_MCU.h" #include "client/GS_TCP_Client.h" #include #include "mbfs/MB_FS.h" @@ -157,7 +158,7 @@ class GAuthManager } #endif -#if defined(PICO_RP2040) +#if defined(MB_ARDUINO_PICO) #if __has_include() #define HAS_WIFIMULTI WiFiMulti *multi = nullptr; diff --git a/src/client/GS_TCP_Client.h b/src/client/GS_TCP_Client.h index f8c41f5..84dbb2c 100644 --- a/src/client/GS_TCP_Client.h +++ b/src/client/GS_TCP_Client.h @@ -1,7 +1,31 @@ +/** + * The MIT License (MIT) + * Copyright (c) 2023 K. Suwatchai (Mobizt) + * + * + * Permission is hereby granted, free of charge, to any person returning a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + #ifndef GS_TCP_Client_H #define GS_TCP_Client_H #include +#include "mbfs/MB_MCU.h" #include "GS_Error.h" #include "GS_Const.h" #include "mbfs/MB_FS.h" @@ -42,7 +66,7 @@ extern "C" #include #define ESP_SIGNER_ESP_SSL_CLIENT BearSSL::WiFiClientSecure -#elif defined(PICO_RP2040) +#elif defined(MB_ARDUINO_PICO) #include #include @@ -71,7 +95,7 @@ class GS_TCP_Client : public Client #if !defined(ESP_GOOGLE_SHEET_CLIENT_ENABLE_EXTERNAL_CLIENT) -#if defined(ESP8266) || defined(PICO_RP2040) +#if defined(ESP8266) || defined(MB_ARDUINO_PICO) client->setBufferSizes(bsslRxSize, bsslTxSize); #endif @@ -80,7 +104,7 @@ class GS_TCP_Client : public Client certType = gs_cert_type_data; #if defined(ESP32) client->setCACert(caCert); -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) x509 = new X509List(caCert); client->setTrustAnchors(x509); #endif @@ -91,7 +115,7 @@ class GS_TCP_Client : public Client client->stop(); #if defined(ESP32) client->setCACert(NULL); -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) client->setNoDelay(true); #endif setInsecure(); @@ -103,7 +127,7 @@ class GS_TCP_Client : public Client { #if !defined(ESP_GOOGLE_SHEET_CLIENT_ENABLE_EXTERNAL_CLIENT) -#if defined(ESP8266) || defined(PICO_RP2040) +#if defined(ESP8266) || defined(MB_ARDUINO_PICO) client->setBufferSizes(bsslRxSize, bsslTxSize); #endif @@ -154,7 +178,7 @@ class GS_TCP_Client : public Client mbfs->close(storageType); } -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) uint8_t *der = MemoryHelper::createBuffer(mbfs, len); if (mbfs->available(storageType)) mbfs->read(storageType, der, len); @@ -180,7 +204,7 @@ class GS_TCP_Client : public Client client->setInsecure(); #endif #endif -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) client->setInsecure(); #endif @@ -190,7 +214,7 @@ class GS_TCP_Client : public Client void setBufferSizes(int rx, int tx) { #if !defined(ESP_GOOGLE_SHEET_CLIENT_ENABLE_EXTERNAL_CLIENT) -#if defined(ESP_8266) || defined(PICO_RP2040) +#if defined(ESP_8266) || defined(MB_ARDUINO_PICO) bsslRxSize = rx; bsslTxSize = tx; if (client) @@ -221,7 +245,7 @@ class GS_TCP_Client : public Client goto ex; #endif -#elif defined(PICO_RP2040) +#elif defined(MB_ARDUINO_PICO) #endif @@ -277,7 +301,7 @@ class GS_TCP_Client : public Client #if !defined(ESP_GOOGLE_SHEET_CLIENT_ENABLE_EXTERNAL_CLIENT) #if defined(ESP32) return client->setTimeout(timeoutmSec / 1000); -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) client->setTimeout(timeoutmSec); #endif #endif @@ -329,7 +353,7 @@ class GS_TCP_Client : public Client ETH.linkUp(); return true; } -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) if (!eth && config) eth = &(config->spi_ethernet_module); @@ -361,7 +385,7 @@ class GS_TCP_Client : public Client } #endif -#elif defined(PICO_RP2040) +#elif defined(MB_ARDUINO_PICO) #endif @@ -629,7 +653,7 @@ class GS_TCP_Client : public Client gauth_cfg_t *config = nullptr; MB_FS *mbfs = nullptr; #if !defined(ESP_GOOGLE_SHEET_CLIENT_ENABLE_EXTERNAL_CLIENT) -#if defined(ESP8266) || defined(PICO_RP2040) +#if defined(ESP8266) || defined(MB_ARDUINO_PICO) #if defined(ESP8266) uint16_t bsslRxSize = 512; uint16_t bsslTxSize = 512; diff --git a/src/json/FirebaseJson.cpp b/src/json/FirebaseJson.cpp index a763971..61e1103 100644 --- a/src/json/FirebaseJson.cpp +++ b/src/json/FirebaseJson.cpp @@ -1,9 +1,9 @@ /* - * FirebaseJson, version 3.0.5 + * FirebaseJson, version 3.0.6 * * The Easiest Arduino library to parse, create and edit JSON object using a relative path. * - * Created January 20, 2023 + * Created March 5, 2023 * * Features * - Using path to access node element in search style e.g. json.get(result,"a/b/c") diff --git a/src/json/FirebaseJson.h b/src/json/FirebaseJson.h index 4f588a6..8f9e239 100644 --- a/src/json/FirebaseJson.h +++ b/src/json/FirebaseJson.h @@ -1,9 +1,9 @@ /* - * FirebaseJson, version 3.0.5 + * FirebaseJson, version 3.0.6 * * The Easiest Arduino library to parse, create and edit JSON object using a relative path. * - * Created January 20, 2023 + * Created March 5, 2023 * * Features * - Using path to access node element in search style e.g. json.get(result,"a/b/c") @@ -39,6 +39,47 @@ #ifndef FirebaseJson_H #define FirebaseJson_H +#include + +#if defined(ESP8266) || defined(ESP32) +#ifndef MB_ARDUINO_ESP +#define MB_ARDUINO_ESP +#endif +#endif + +#if defined(__arm__) +#ifndef MB_ARDUINO_ARM +#define MB_ARDUINO_ARM +#endif +#endif + +#if defined(ARDUINO_ARCH_SAMD) +#ifndef MB_ARDUINO_ARCH_SAMD +#define MB_ARDUINO_ARCH_SAMD +#endif +#endif + +#if defined(ARDUINO_ARCH_RP2040) + +#if defined(ARDUINO_NANO_RP2040_CONNECT) +#ifndef MB_ARDUINO_NANO_RP2040_CONNECT +#define MB_ARDUINO_NANO_RP2040_CONNECT +#endif +#else +#ifndef MB_ARDUINO_PICO +#define MB_ARDUINO_PICO +#endif +#endif + +#endif + + +#if defined(TEENSYDUINO) +#ifndef MB_ARDUINO_TEENSY +#define MB_ARDUINO_TEENSY +#endif +#endif + #if defined __has_include #if __has_include() #include @@ -63,7 +104,7 @@ #endif #endif -#include + #include #include "MB_List.h" @@ -761,7 +802,7 @@ class FirebaseJsonBase } #if defined(MB_JSON_FS_H) -#if defined(PICO_RP2040) +#if defined(MB_ARDUINO_PICO) template auto toStringHandler(T &out, bool prettify) -> typename MB_ENABLE_IF::value, bool>::type { diff --git a/src/mbfs/MB_FS.h b/src/mbfs/MB_FS.h index 4bd8296..d4282e5 100644 --- a/src/mbfs/MB_FS.h +++ b/src/mbfs/MB_FS.h @@ -1,9 +1,9 @@ /** - * The MB_FS, filesystems wrapper class v1.0.13 + * The MB_FS, filesystems wrapper class v1.0.15 * * This wrapper class is for SD and Flash filesystems interface which supports SdFat (//https://github.com/greiman/SdFat) * - * Created February 4, 2023 + * Created March 5, 2023 * * The MIT License (MIT) * Copyright (c) 2023 K. Suwatchai (Mobizt) @@ -30,8 +30,11 @@ #ifndef MBFS_CLASS_H #define MBFS_CLASS_H +#include +#include "mbfs/MB_MCU.h" + #define FS_NO_GLOBALS -#if defined(ESP32) || defined(ESP8266) || defined(PICO_RP2040) +#if defined(ESP32) || defined(ESP8266) || defined(MB_ARDUINO_PICO) #include #endif #include "MB_FS_Interfaces.h" @@ -135,7 +138,7 @@ struct mbfs_sd_config_info_t #endif }; -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) struct mbfs_sd_config_info_t { int ss = -1; @@ -177,7 +180,7 @@ class MB_FS #elif defined(ESP8266) || defined(ARDUINO_ARCH_SAMD) || defined(__AVR_ATmega4809__) || defined(ARDUINO_NANO_RP2040_CONNECT) sd_rdy = MBFS_SD_FS.begin(ss); return sd_rdy; -#elif defined(PICO_RP2040) +#elif defined(MB_ARDUINO_PICO) SDFSConfig c; c.setCSPin(ss); c.setSPISpeed(frequency); @@ -217,7 +220,7 @@ class MB_FS sd_rdy = MBFS_SD_FS.begin(); #endif -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) cfg->_int.sd_config.sck = sck; @@ -285,7 +288,7 @@ class MB_FS } #endif -#if (defined(ESP8266) || defined(PICO_RP2040)) && defined(MBFS_SD_FS) +#if (defined(ESP8266) || defined(MB_ARDUINO_PICO)) && defined(MBFS_SD_FS) // Assign the SD card interfaces with SDFSConfig object pointer (ESP8266 and Pico only). bool sdFatBegin(SDFSConfig *sdFSConfig) { @@ -342,7 +345,7 @@ class MB_FS flash_rdy = MBFS_FLASH_FS.begin(); #endif -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) flash_rdy = MBFS_FLASH_FS.begin(); #endif @@ -392,7 +395,7 @@ class MB_FS sd_rdy = sdMMCBegin(sd_config.sdMMCConfig.mountpoint, sd_config.sdMMCConfig.mode1bit, sd_config.sdMMCConfig.format_if_mount_failed); #endif -#elif defined(ESP8266) || defined(PICO_RP2040) +#elif defined(ESP8266) || defined(MB_ARDUINO_PICO) if (!sd_rdy) { if (sd_config.sdFSConfig) @@ -935,7 +938,7 @@ class MB_FS return true; #endif -#if defined(MBFS_SD_FS) && (defined(ESP32) || defined(ESP8266) || defined(PICO_RP2040)) +#if defined(MBFS_SD_FS) && (defined(ESP32) || defined(ESP8266) || defined(MB_ARDUINO_PICO)) return true; #endif diff --git a/src/mbfs/MB_MCU.h b/src/mbfs/MB_MCU.h new file mode 100644 index 0000000..d620314 --- /dev/null +++ b/src/mbfs/MB_MCU.h @@ -0,0 +1,47 @@ +#pragma once + +#ifndef MB_MCU_H +#define MB_MCU_H + + +#if defined(ESP8266) || defined(ESP32) +#ifndef MB_ARDUINO_ESP +#define MB_ARDUINO_ESP +#endif +#endif + +#if defined(__arm__) +#ifndef MB_ARDUINO_ARM +#define MB_ARDUINO_ARM +#endif +#endif + +#if defined(ARDUINO_ARCH_SAMD) +#ifndef MB_ARDUINO_ARCH_SAMD +#define MB_ARDUINO_ARCH_SAMD +#endif +#endif + +#if defined(ARDUINO_ARCH_RP2040) + +#if defined(ARDUINO_NANO_RP2040_CONNECT) +#ifndef MB_ARDUINO_NANO_RP2040_CONNECT +#define MB_ARDUINO_NANO_RP2040_CONNECT +#endif +#else +#ifndef MB_ARDUINO_PICO +#define MB_ARDUINO_PICO +#endif +#endif + +#endif + + +#if defined(TEENSYDUINO) +#ifndef MB_ARDUINO_TEENSY +#define MB_ARDUINO_TEENSY +#endif +#endif + + +#endif \ No newline at end of file