Fix possible race condition and ensure proper reset flag detection
This commit is contained in:
@@ -192,6 +192,8 @@ static void WriteRaw(int addr, byte data)
|
||||
|
||||
static byte ReadRaw(int addr)
|
||||
{
|
||||
byte data;
|
||||
|
||||
// The EEPROM Read Enable Signal EERE is the read
|
||||
// strobe to the EEPROM. When the correct address
|
||||
// is set up in the EEAR Register, the EERE bit
|
||||
@@ -214,7 +216,8 @@ static byte ReadRaw(int addr)
|
||||
|
||||
// Read from address
|
||||
EECR |= BIT(EERE);
|
||||
data = EEDR;
|
||||
}
|
||||
|
||||
return EEDR;
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user