Go Down

Topic: Problem with EEPROM on arduino Slide guide (Read 2016 times) previous topic - next topic

Firmament

Hi For anyone who uses liquidware Arduino0018-Antipasto0043 who wanna use the EEPROM functionality for touch shield SLIDE but realised copying the EEPROM library from the Arduino side doesn't work well heres the guide.

Strangely enough by simply copying the library from Arduino Core works for Stealth but not Slide, i'm not sure if its a bug or something but heres the solution.

To use EEPROM on Touch Shield
1)Copy EEPROM from your arudino folder(ur path might differ)
desktop/antipasto/hardware/arduino/cores/arduino/src/components/library
2)well COPY folder EEPROM and paste in following path
desktop/antipasto/hardware/arduino/cores/touchshield/src/components/library

If you are running touch shield Stealth u can stop here. EEPROM examples will be available under file tab, Examples.

If you are trying to run Slide, then carry on.

3) Go to the following path and open the file
desktop/antipasto/hardware/tools/avr/avr/include/avr/eeprom

4) make the following changes(suggest you use Ctrl F and search for eeprom_read_block and eeprom_write_block). The fonts in red are the ones to remove, its the original code, remove them or comment them out. The fonts in Green are to be added.

eeprom_read_block (void *__dst, const void *__src, size_t __n)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
  __eerd_block (__dst, __src, __n, eeprom_read_byte);
#else
  /* If ATmega256x device, do not call function. */
    const uint8_t *S = (const uint8_t *)__src;
      uint8_t *D = (uint8_t *)__dst;
  while (__n--)
  {
   //*(char *)__dst++ = eeprom_read_byte(__src++);
    *D = eeprom_read_byte(S);
    D++; S++;
  }
#endif
}


static __inline__ int
eeprom_write_block (const void *__src, void  *__dst, size_t __n)
{
#if (! (defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)) )
  __eewr_block (__dst, __src, __n, eeprom_write_byte);
#else
  /* If ATmega256x device, do not call function. */
  const uint8_t *S = (const uint8_t *)__src;
 uint8_t *D = (uint8_t *)__dst;
    while (__n--)
    //eeprom_write_byte (__dst++, *(uint8_t *)__src++);
   
     eeprom_write_byte (D, *S);
     D++; S++;

#endif
}

Hope this little guide is helpful to anyone who attempts to use EEPROM on Slide.

Special Thanks To Riddick for all the help provided and to make this guide possible.

Regards
Jonathan.

Go Up