[HAL] Disable EEPROM on Arduino Due
This commit is contained in:
parent
58eab402ad
commit
7de4a4693e
3 changed files with 28 additions and 17 deletions
|
@ -2,7 +2,9 @@
|
|||
|
||||
#if defined(RADIOLIB_BUILD_ARDUINO)
|
||||
|
||||
#if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
|
||||
#include <EEPROM.h>
|
||||
#endif
|
||||
|
||||
ArduinoHal::ArduinoHal(): RadioLibHal(INPUT, OUTPUT, LOW, HIGH, RISING, FALLING), spi(&RADIOLIB_DEFAULT_SPI), initInterface(true) {}
|
||||
|
||||
|
@ -101,27 +103,31 @@ void inline ArduinoHal::spiEnd() {
|
|||
}
|
||||
|
||||
void ArduinoHal::readPersistentStorage(uint32_t addr, uint8_t* buff, size_t len) {
|
||||
#if defined(RADIOLIB_ESP32)
|
||||
EEPROM.begin(RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE);
|
||||
#endif
|
||||
for(size_t i = 0; i < len; i++) {
|
||||
buff[i] = EEPROM.read(addr + i);
|
||||
}
|
||||
#if defined(RADIOLIB_ESP32)
|
||||
EEPROM.end();
|
||||
#if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
|
||||
#if defined(RADIOLIB_ESP32)
|
||||
EEPROM.begin(RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE);
|
||||
#endif
|
||||
for(size_t i = 0; i < len; i++) {
|
||||
buff[i] = EEPROM.read(addr + i);
|
||||
}
|
||||
#if defined(RADIOLIB_ESP32)
|
||||
EEPROM.end();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void ArduinoHal::writePersistentStorage(uint32_t addr, uint8_t* buff, size_t len) {
|
||||
#if defined(RADIOLIB_ESP32)
|
||||
EEPROM.begin(RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE);
|
||||
#endif
|
||||
for(size_t i = 0; i < len; i++) {
|
||||
EEPROM.write(addr + i, buff[i]);
|
||||
}
|
||||
#if defined(RADIOLIB_ESP32)
|
||||
EEPROM.commit();
|
||||
EEPROM.end();
|
||||
#if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
|
||||
#if defined(RADIOLIB_ESP32)
|
||||
EEPROM.begin(RADIOLIB_HAL_PERSISTENT_STORAGE_SIZE);
|
||||
#endif
|
||||
for(size_t i = 0; i < len; i++) {
|
||||
EEPROM.write(addr + i, buff[i]);
|
||||
}
|
||||
#if defined(RADIOLIB_ESP32)
|
||||
EEPROM.commit();
|
||||
EEPROM.end();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,7 @@
|
|||
// Arduino Due
|
||||
#define RADIOLIB_PLATFORM "Arduino Due"
|
||||
#define RADIOLIB_TONE_UNSUPPORTED
|
||||
#define RADIOLIB_EEPROM_UNSUPPORTED
|
||||
|
||||
#elif (defined(NRF52832_XXAA) || defined(NRF52840_XXAA)) && !defined(ARDUINO_ARDUINO_NANO33BLE)
|
||||
// Adafruit nRF52 boards
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
// flag to indicate whether we have received a downlink
|
||||
static volatile bool downlinkReceived = false;
|
||||
|
||||
#if defined(RADIOLIB_EEPROM_UNSUPPORTED)
|
||||
#warning "Persistent storage not supported!"
|
||||
#endif
|
||||
|
||||
// interrupt service routine to handle downlinks automatically
|
||||
#if defined(ESP8266) || defined(ESP32)
|
||||
IRAM_ATTR
|
||||
|
|
Loading…
Add table
Reference in a new issue