summaryrefslogtreecommitdiff
path: root/src/storage.cc
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-02-21 20:19:55 +0100
committerDaniel Friesel <derf@finalrewind.org>2016-02-21 20:19:55 +0100
commit3a02241ad1fbd89a6603fb699989cb9f3c9b200d (patch)
treef8f3b88f27a38e6ccc7097d37c0dcd82f2234dac /src/storage.cc
parentd75a6cd36db515a0863a03480d8e5c589a235e22 (diff)
add animation load function -- untested, needs I2C debugging first
Diffstat (limited to 'src/storage.cc')
-rw-r--r--src/storage.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/storage.cc b/src/storage.cc
index 98a90f0..a517f53 100644
--- a/src/storage.cc
+++ b/src/storage.cc
@@ -186,8 +186,9 @@ uint8_t Storage::i2c_read(uint16_t pos, uint8_t len, uint8_t *data)
void Storage::reset()
{
first_free_page = 0;
+ num_anims = 0xff;
+ i2c_write(0, 1, &num_anims); // pretend the EEPROM was never written to
num_anims = 0;
- i2c_write(0, 1, &num_anims);
}
bool Storage::hasData()
@@ -205,7 +206,7 @@ void Storage::load(uint16_t idx, uint8_t *data)
i2c_read(1 + idx, 1, &page_offset);
i2c_read(256 + (64 * (uint16_t)page_offset), 2, header);
- i2c_read(256 + (64 * (uint16_t)page_offset) + 2, (header[0] << 4) + (header[1] >> 4), data);
+ i2c_read(256 + (64 * (uint16_t)page_offset), header[1] + 2, data);
}
void Storage::save(uint8_t *data)