implemented clear_memory()
This commit is contained in:
parent
7af0a8a5b8
commit
1f05f5a8b8
|
@ -233,27 +233,28 @@ void save_code()
|
||||||
void clear_memory(void)
|
void clear_memory(void)
|
||||||
{
|
{
|
||||||
uint16_t address;
|
uint16_t address;
|
||||||
uint8_t stored[3];
|
|
||||||
/* start at begining of the memory */
|
|
||||||
send_start();
|
|
||||||
if (send_byte(0xa0)) { /* write address to eeprom at 0xA0/0x50 */
|
|
||||||
send_stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (send_byte(0x00)) { /* go to address 0x0000 */
|
|
||||||
send_stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (send_byte(0x00)) { /* go to address 0x0000 */
|
|
||||||
send_stop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* go through memory */
|
/* go through memory */
|
||||||
for (address=0; address<0x7FFF; address++) {
|
for (address=0; address<0x7FFF; address++) {
|
||||||
|
if ((address%0x40)==0) { /* select page */
|
||||||
|
send_start(); /* start transaction */
|
||||||
|
if (send_byte(0xa0)) { /* write address to eeprom at 0xA0/0x50 */
|
||||||
|
send_stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (send_byte(address>>8)) { /* go to address */
|
||||||
|
send_stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (send_byte(address&0xff)) { /* go to address */
|
||||||
|
send_stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
send_byte(0x00); /* clear byte */
|
send_byte(0x00); /* clear byte */
|
||||||
|
if ((address%0x40)==0x3f) { /* end of page */
|
||||||
|
send_stop(); /* finish transaction */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
send_stop(); /* finish transaction */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* funcion called on interrupts */
|
/* funcion called on interrupts */
|
||||||
|
|
Loading…
Reference in New Issue