Browse Source

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

feature/2015
Christian Kroll 10 years ago
parent
commit
d5d58f8c0d
  1. 1
      src/games/tetris/highscore.c
  2. 3
      src/games/tetris/highscore.h
  3. 1
      src/uart/uart_commands.c

1
src/games/tetris/highscore.c

@ -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]);

3
src/games/tetris/highscore.h

@ -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);
} }

1
src/uart/uart_commands.c

@ -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

Loading…
Cancel
Save