fix addressability issues for last 64K of EEPROM
This commit is contained in:
parent
ab6bb7d14b
commit
3d7584a951
3
data.cpp
3
data.cpp
|
@ -21,11 +21,10 @@ static void flash_data() {
|
|||
count = serial::read(buffer, eeprom::PAGE_SIZE);
|
||||
eeprom::page_write(at, buffer);
|
||||
at += eeprom::PAGE_SIZE;
|
||||
delay(10);
|
||||
} while(count == eeprom::PAGE_SIZE);
|
||||
|
||||
while(serial::is_connected()) {
|
||||
serial::get();
|
||||
serial::read(buffer, eeprom::PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ static void wait_for_responsive(uint8_t i2c_addr) {
|
|||
static uint8_t get_i2c_addr(uint32_t at) {
|
||||
uint8_t i2c_addr = ADDR;
|
||||
if(at > 0xffff) {
|
||||
i2c_addr |= 0b100;
|
||||
i2c_addr |= 1;
|
||||
}
|
||||
return i2c_addr;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ void eeprom::init() {
|
|||
}
|
||||
|
||||
void eeprom::jump(uint32_t p_at) {
|
||||
p_at = at;
|
||||
at = p_at;
|
||||
}
|
||||
|
||||
void eeprom::read(char* data, uint16_t data_size) {
|
||||
|
@ -75,6 +75,7 @@ void eeprom::read(char* data, uint16_t data_size) {
|
|||
}
|
||||
|
||||
void eeprom::page_write(uint32_t at, const char* data) {
|
||||
if(at >= LENGTH) return;
|
||||
uint8_t i2c_addr = get_i2c_addr(at);
|
||||
wait_for_responsive(i2c_addr);
|
||||
mem.start_write(i2c_addr);
|
||||
|
|
Loading…
Reference in New Issue