Fix arduino build for ESP32

This commit is contained in:
VietDzung 2025-07-03 14:49:45 +07:00
parent e3f5329ea5
commit ef7f6fc1ad
3 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,4 @@
#ifndef ARDUINO
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
// esp32_idf_platform.cpp // esp32_idf_platform.cpp
#include <esp_system.h> #include <esp_system.h>
@ -428,4 +429,5 @@ void attachInterrupt(uint32_t pin, IsrFuncPtr callback, uint32_t mode)
ESP_ERROR_CHECK(gpio_isr_handler_add((gpio_num_t)pin, isr_wrapper, (void*)callback)); ESP_ERROR_CHECK(gpio_isr_handler_add((gpio_num_t)pin, isr_wrapper, (void*)callback));
} }
#endif #endif // ESP_PLATFORM
#endif // !ARDUINO

View File

@ -1,3 +1,4 @@
#ifndef ARDUINO
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
// esp_idf_platform.h // esp_idf_platform.h
#pragma once #pragma once
@ -82,4 +83,5 @@ class Esp32IdfPlatform : public Platform
const char* _nvs_namespace = "eeprom"; const char* _nvs_namespace = "eeprom";
const char* _nvs_key = "eeprom"; const char* _nvs_key = "eeprom";
}; };
#endif
#endif #endif

View File

@ -178,6 +178,7 @@ uint16_t crc16Dnp(uint8_t* input, uint16_t length)
} }
// Produce Arduino print and println in ESP IDF for ESP32 family using printf(). // Produce Arduino print and println in ESP IDF for ESP32 family using printf().
#ifndef ARDUINO
#ifdef ESP_PLATFORM #ifdef ESP_PLATFORM
// Helper function to print a number in binary format // Helper function to print a number in binary format
static void print_binary(unsigned long long n) static void print_binary(unsigned long long n)
@ -360,3 +361,4 @@ void println(double num) {
println(); println();
} }
#endif // ESP_PLATFORM #endif // ESP_PLATFORM
#endif // !ARDUINO