[HAL] Disable EEPROM on Arduino Due

This commit is contained in:
jgromes 2023-09-15 18:10:47 +02:00
parent 58eab402ad
commit 7de4a4693e
3 changed files with 28 additions and 17 deletions

View file

@ -2,7 +2,9 @@
#if defined(RADIOLIB_BUILD_ARDUINO) #if defined(RADIOLIB_BUILD_ARDUINO)
#if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
#include <EEPROM.h> #include <EEPROM.h>
#endif
ArduinoHal::ArduinoHal(): RadioLibHal(INPUT, OUTPUT, LOW, HIGH, RISING, FALLING), spi(&RADIOLIB_DEFAULT_SPI), initInterface(true) {} ArduinoHal::ArduinoHal(): RadioLibHal(INPUT, OUTPUT, LOW, HIGH, RISING, FALLING), spi(&RADIOLIB_DEFAULT_SPI), initInterface(true) {}
@ -101,6 +103,7 @@ void inline ArduinoHal::spiEnd() {
} }
void ArduinoHal::readPersistentStorage(uint32_t addr, uint8_t* buff, size_t len) { void ArduinoHal::readPersistentStorage(uint32_t addr, uint8_t* buff, size_t len) {
#if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
#if defined(RADIOLIB_ESP32) #if defined(RADIOLIB_ESP32)
EEPROM.begin(RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE); EEPROM.begin(RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE);
#endif #endif
@ -110,9 +113,11 @@ void ArduinoHal::readPersistentStorage(uint32_t addr, uint8_t* buff, size_t len)
#if defined(RADIOLIB_ESP32) #if defined(RADIOLIB_ESP32)
EEPROM.end(); EEPROM.end();
#endif #endif
#endif
} }
void ArduinoHal::writePersistentStorage(uint32_t addr, uint8_t* buff, size_t len) { void ArduinoHal::writePersistentStorage(uint32_t addr, uint8_t* buff, size_t len) {
#if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
#if defined(RADIOLIB_ESP32) #if defined(RADIOLIB_ESP32)
EEPROM.begin(RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE); EEPROM.begin(RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE);
#endif #endif
@ -123,6 +128,7 @@ void ArduinoHal::writePersistentStorage(uint32_t addr, uint8_t* buff, size_t len
EEPROM.commit(); EEPROM.commit();
EEPROM.end(); EEPROM.end();
#endif #endif
#endif
} }
void inline ArduinoHal::tone(uint32_t pin, unsigned int frequency, unsigned long duration) { void inline ArduinoHal::tone(uint32_t pin, unsigned int frequency, unsigned long duration) {

View file

@ -117,6 +117,7 @@
// Arduino Due // Arduino Due
#define RADIOLIB_PLATFORM "Arduino Due" #define RADIOLIB_PLATFORM "Arduino Due"
#define RADIOLIB_TONE_UNSUPPORTED #define RADIOLIB_TONE_UNSUPPORTED
#define RADIOLIB_EEPROM_UNSUPPORTED
#elif (defined(NRF52832_XXAA) || defined(NRF52840_XXAA)) && !defined(ARDUINO_ARDUINO_NANO33BLE) #elif (defined(NRF52832_XXAA) || defined(NRF52840_XXAA)) && !defined(ARDUINO_ARDUINO_NANO33BLE)
// Adafruit nRF52 boards // Adafruit nRF52 boards

View file

@ -7,6 +7,10 @@
// flag to indicate whether we have received a downlink // flag to indicate whether we have received a downlink
static volatile bool downlinkReceived = false; static volatile bool downlinkReceived = false;
#if defined(RADIOLIB_EEPROM_UNSUPPORTED)
#warning "Persistent storage not supported!"
#endif
// interrupt service routine to handle downlinks automatically // interrupt service routine to handle downlinks automatically
#if defined(ESP8266) || defined(ESP32) #if defined(ESP8266) || defined(ESP32)
IRAM_ATTR IRAM_ATTR