add eeprom_busy_wait() to some routines; better safe than sorry

This commit is contained in:
Christian Kroll 2014-09-07 21:32:49 +02:00
parent 7d0022a22d
commit d5d58f8c0d
3 changed files with 5 additions and 0 deletions

View File

@ -109,6 +109,7 @@ uint16_t tetris_highscore_inputName(void)
uint16_t tetris_highscore_retrieveHighScore(tetris_highscore_index_t nIndex) uint16_t tetris_highscore_retrieveHighScore(tetris_highscore_index_t nIndex)
{ {
eeprom_busy_wait();
uint16_t nHighScore = uint16_t nHighScore =
eeprom_read_word(&g_highScoreTable.nHighScore[nIndex]); eeprom_read_word(&g_highScoreTable.nHighScore[nIndex]);

View File

@ -78,6 +78,7 @@ void tetris_highscore_saveHighScore(tetris_highscore_index_t nIndex,
{ {
if (nHighScore > tetris_highscore_retrieveHighScore(nIndex)) if (nHighScore > tetris_highscore_retrieveHighScore(nIndex))
{ {
eeprom_busy_wait();
eeprom_write_word(&g_highScoreTable.nHighScore[nIndex], nHighScore); eeprom_write_word(&g_highScoreTable.nHighScore[nIndex], nHighScore);
} }
} }
@ -91,6 +92,7 @@ void tetris_highscore_saveHighScore(tetris_highscore_index_t nIndex,
inline static inline static
uint16_t tetris_highscore_retrieveHighScoreName(tetris_highscore_index_t nIdx) uint16_t tetris_highscore_retrieveHighScoreName(tetris_highscore_index_t nIdx)
{ {
eeprom_busy_wait();
uint16_t nHighScoreName = uint16_t nHighScoreName =
eeprom_read_word(&g_highScoreTable.nHighScoreName[nIdx]); eeprom_read_word(&g_highScoreTable.nHighScoreName[nIdx]);
@ -107,6 +109,7 @@ inline static
void tetris_highscore_saveHighScoreName(tetris_highscore_index_t nIndex, void tetris_highscore_saveHighScoreName(tetris_highscore_index_t nIndex,
uint16_t nHighscoreName) uint16_t nHighscoreName)
{ {
eeprom_busy_wait();
eeprom_write_word(&g_highScoreTable.nHighScoreName[nIndex], nHighscoreName); eeprom_write_word(&g_highScoreTable.nHighScoreName[nIndex], nHighscoreName);
} }

View File

@ -97,6 +97,7 @@ static void uartcmd_erase_eeprom(void) {
{0xFF, 0xFF}; {0xFF, 0xFF};
# endif # endif
for (void *ee = 0; ee < (void *)E2END; ee += E2PAGESIZE) { for (void *ee = 0; ee < (void *)E2END; ee += E2PAGESIZE) {
eeprom_busy_wait();
eeprom_update_block(eeclear, ee, E2PAGESIZE); eeprom_update_block(eeclear, ee, E2PAGESIZE);
} }
#else #else