core: Fix bootmagic

- EEPROM_CLEAR wipes out eeprom with 0xFF now(avr)
- keymap config is not enabled during bootmagic
- wait until all key is released after bootmagic
- add eeconfig_debug() to command.c
This commit is contained in:
tmk 2023-11-26 22:10:34 +09:00
parent 66da6f4d64
commit 1cc716477b
4 changed files with 52 additions and 13 deletions

View file

@ -3,6 +3,7 @@
#include <avr/eeprom.h>
#include "eeconfig.h"
#include "keymap.h"
#include "print.h"
void eeconfig_init(void)
{
@ -27,7 +28,12 @@ void eeconfig_enable(void)
void eeconfig_disable(void)
{
eeprom_write_word(EECONFIG_MAGIC, 0xFFFF);
eeprom_write_word(EECONFIG_MAGIC, 0xFFFF);
eeprom_write_byte(EECONFIG_DEBUG, 0xFF);
eeprom_write_byte(EECONFIG_DEFAULT_LAYER, 0xFF);
eeprom_write_byte(EECONFIG_KEYMAP, 0xFF);
eeprom_write_byte(EECONFIG_MOUSEKEY_ACCEL, 0xFF);
eeprom_write_byte(EECONFIG_BACKLIGHT, 0xFF);
}
bool eeconfig_is_enabled(void)
@ -48,3 +54,13 @@ void eeconfig_write_keymap(uint8_t val) { eeprom_write_byte(EECONFIG_KEYMAP, val
uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); }
void eeconfig_write_backlight(uint8_t val) { eeprom_write_byte(EECONFIG_BACKLIGHT, val); }
#endif
void eeconfig_debug(void)
{
xprintf("eeprom:");
for (int i = 0; i < 16 /* E2END + 1 */; i++) {
if ((i % 16) == 0) { xprintf("\n%04X: ", i); }
xprintf("%02X ", eeprom_read_byte((uint8_t *)i));
}
xprintf("\n");
}