fabriziop / EEWL

The EEWL library allows to extend the EEPROM life by distributing data writes along a circular buffer.
GNU Lesser General Public License v3.0
10 stars 1 forks source link

Support for RP2040 #7

Closed vanbwodonk closed 11 months ago

vanbwodonk commented 11 months ago

Hi, I'm using this for ESP32 and it works great!!

Just want to ask, is this library support arduino core for RP2040 ? (https://github.com/earlephilhower/arduino-pico)

fabriziop commented 11 months ago

Hi, I just compiled the example countPowerCycles against the arduino-pico on Arduino IDE without errors and with minimal changes to the EEWL library. I have no RP2040 boards, so I must stop here for now.

vanbwodonk commented 11 months ago

Thanks @fabriziop, i can help you to test, with my raspberry pi pico.

fabriziop commented 11 months ago

Ok, if you want to test, you need to edit file .../EEWL/src/eewl.h: add || defined(__arm__) at the end of the line marked with double asterisks as follows. Remember to compile with Arduino-pico.

` / macros /

ifdef EEWL_RAM

#define EE_WRITE( addr , val ) (buffer[(int)( addr )] = val)
#define EE_READ( addr ) (buffer[(int)( addr )])

else

#ifdef __AVR__
  #define EE_WRITE( addr , val ) (EEPROM[ (int)( addr )  ].update( val ))

**#elif defined(ESP8266) || defined(ESP32) || defined(arm)

define EE_WRITE( addr , val ) (EEPROM.write((int)( addr ),( val )))

#else
  #error ERROR: unsupported architecture 
#endif
#ifdef ESP32
  #define EE_READ( addr ) (EEPROM.read((int)( addr )))
#else
  #define EE_READ( addr ) (EEPROM[ (int)( addr ) ])
#endif
#include <EEPROM.h>

endif

`

vanbwodonk commented 11 months ago

try edit and compile with arduino-pico core, got this error

In file included from /home/drw/Arduino/libraries/EEWL/examples/countPowerCycles/countPowerCycles.ino:24:
/home/drw/Arduino/libraries/EEWL/src/eewl.h: In member function 'void EEWL::begin()':
/home/drw/Arduino/libraries/EEWL/src/eewl.h:102:10: error: 'eepromBeginDone' was not declared in this scope
  102 |     if (!eepromBeginDone) {
      |          ^~~~~~~~~~~~~~~
vanbwodonk commented 11 months ago

closed with PR #8