diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-02-21 20:19:55 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-02-21 20:19:55 +0100 |
commit | 3a02241ad1fbd89a6603fb699989cb9f3c9b200d (patch) | |
tree | f8f3b88f27a38e6ccc7097d37c0dcd82f2234dac /src/storage.cc | |
parent | d75a6cd36db515a0863a03480d8e5c589a235e22 (diff) |
add animation load function -- untested, needs I2C debugging first
Diffstat (limited to 'src/storage.cc')
-rw-r--r-- | src/storage.cc | 5 |
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) |