added work-around for ATtiny1614 range of chips that have a bug in: eeprom_is_ready()

This commit is contained in:
Alex Shepherd
2020-05-30 16:14:27 +12:00
parent 38194c0148
commit dead808af2
3 changed files with 13 additions and 13 deletions

View File

@@ -46,9 +46,7 @@
//------------------------------------------------------------------------ //------------------------------------------------------------------------
#include "NmraDcc.h" #include "NmraDcc.h"
#ifdef __AVR_MEGA__ #include "EEPROM.h"
#include <avr/eeprom.h>
#endif
// Uncomment to print DEBUG messages // Uncomment to print DEBUG messages
// #define DEBUG_PRINT // #define DEBUG_PRINT
@@ -629,7 +627,8 @@ uint8_t readEEPROM( unsigned int CV ) {
return EEPROM.read(CV) ; return EEPROM.read(CV) ;
} }
void writeEEPROM( unsigned int CV, uint8_t Value ) { void writeEEPROM( unsigned int CV, uint8_t Value )
{
EEPROM.write(CV, Value) ; EEPROM.write(CV, Value) ;
#if defined(ESP8266) #if defined(ESP8266)
EEPROM.commit(); EEPROM.commit();
@@ -639,12 +638,15 @@ void writeEEPROM( unsigned int CV, uint8_t Value ) {
#endif #endif
} }
bool readyEEPROM() { bool readyEEPROM()
#ifdef __AVR_MEGA__ {
return eeprom_is_ready(); #if defined ARDUINO_ARCH_MEGAAVR
#else return bit_is_clear(NVMCTRL.STATUS,NVMCTRL_EEBUSY_bp);
return true; #elif defined __AVR_MEGA__
#endif return eeprom_is_ready();
#else
return true;
#endif
} }

View File

@@ -54,8 +54,6 @@
#include "WProgram.h" #include "WProgram.h"
#endif #endif
#include "EEPROM.h"
#ifndef NMRADCC_IS_IN #ifndef NMRADCC_IS_IN
#define NMRADCC_IS_IN #define NMRADCC_IS_IN

View File

@@ -1,5 +1,5 @@
name=NmraDcc name=NmraDcc
version=2.0.3 version=2.0.4
author=Alex Shepherd, Wolfgang Kuffer, Geoff Bunza, Martin Pischky, Franz-Peter Müller, Sven (littleyoda), Hans Tanner author=Alex Shepherd, Wolfgang Kuffer, Geoff Bunza, Martin Pischky, Franz-Peter Müller, Sven (littleyoda), Hans Tanner
maintainer=Alex Shepherd <kiwi64ajs@gmail.com> maintainer=Alex Shepherd <kiwi64ajs@gmail.com>
sentence=Enables NMRA DCC Communication sentence=Enables NMRA DCC Communication