diff --git a/rmk/src/keymap.rs b/rmk/src/keymap.rs index ec806d99..e6a19692 100644 --- a/rmk/src/keymap.rs +++ b/rmk/src/keymap.rs @@ -71,11 +71,15 @@ impl< let eeprom = match storage { Some(s) => { // TODO: Refactor Eeprom so that we don't need this anymore - let eeprom_storage_config = EepromStorageConfig { + let mut eeprom_storage_config = EepromStorageConfig { start_addr: (F::ERASE_SIZE * (s.capacity() / F::ERASE_SIZE - 1)) as u32, storage_size: F::ERASE_SIZE as u32, page_size: F::WRITE_SIZE as u32, }; + // At least write 4 byte(1 record) + if eeprom_storage_config.page_size < 4 { + eeprom_storage_config.page_size = 4; + } let e = Eeprom::new(s, eeprom_storage_config, eeconfig, &mut action_map); // If eeprom is initialized, read keymap from it. match e {