diff --git a/builddefs/common_features.mk b/builddefs/common_features.mk index 609d76d80082..10b5fff280ea 100644 --- a/builddefs/common_features.mk +++ b/builddefs/common_features.mk @@ -249,7 +249,7 @@ else endif endif -VALID_WEAR_LEVELING_DRIVER_TYPES := custom embedded_flash spi_flash rp2040_flash legacy sn32 +VALID_WEAR_LEVELING_DRIVER_TYPES := custom embedded_flash spi_flash rp2040_flash legacy sn32_flash WEAR_LEVELING_DRIVER ?= none ifneq ($(strip $(WEAR_LEVELING_DRIVER)),none) ifeq ($(filter $(WEAR_LEVELING_DRIVER),$(VALID_WEAR_LEVELING_DRIVER_TYPES)),) @@ -277,9 +277,9 @@ ifneq ($(strip $(WEAR_LEVELING_DRIVER)),none) COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/flash SRC += flash_stm32.c wear_leveling_legacy.c POST_CONFIG_H += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/wear_leveling/wear_leveling_legacy_config.h - else ifeq ($(strip $(WEAR_LEVELING_DRIVER)), sn32) - SRC += wear_leveling_sn32.c - POST_CONFIG_H += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/wear_leveling/wear_leveling_sn32_config.h + else ifeq ($(strip $(WEAR_LEVELING_DRIVER)), sn32_flash) + SRC += wear_leveling_sn32_flash.c + POST_CONFIG_H += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/wear_leveling/wear_leveling_sn32_flash_config.h endif endif endif diff --git a/keyboards/handwired/onekey/sn32/rules.mk b/keyboards/handwired/onekey/sn32/rules.mk index 11832616931b..047de4137dd5 100644 --- a/keyboards/handwired/onekey/sn32/rules.mk +++ b/keyboards/handwired/onekey/sn32/rules.mk @@ -1,2 +1,2 @@ EEPROM_DRIVER = wear_leveling -WEAR_LEVELING_DRIVER = sn32 +WEAR_LEVELING_DRIVER = sn32_flash diff --git a/platforms/chibios/drivers/wear_leveling/wear_leveling_sn32.c b/platforms/chibios/drivers/wear_leveling/wear_leveling_sn32_flash.c similarity index 100% rename from platforms/chibios/drivers/wear_leveling/wear_leveling_sn32.c rename to platforms/chibios/drivers/wear_leveling/wear_leveling_sn32_flash.c diff --git a/platforms/chibios/drivers/wear_leveling/wear_leveling_sn32_config.h b/platforms/chibios/drivers/wear_leveling/wear_leveling_sn32_flash_config.h similarity index 87% rename from platforms/chibios/drivers/wear_leveling/wear_leveling_sn32_config.h rename to platforms/chibios/drivers/wear_leveling/wear_leveling_sn32_flash_config.h index 0f3ccabf512a..5b1b9eb7fb2e 100644 --- a/platforms/chibios/drivers/wear_leveling/wear_leveling_sn32_config.h +++ b/platforms/chibios/drivers/wear_leveling/wear_leveling_sn32_flash_config.h @@ -6,7 +6,7 @@ #ifndef WEAR_LEVELING_SN32_PAGE_SIZE # if defined(QMK_MCU_SERIES_SN32F240B) # define WEAR_LEVELING_SN32_PAGE_SIZE 64 -# elif defined(QMK_MCU_SERIES_SN32F240) +# elif defined(QMK_MCU_SERIES_SN32F260) # define WEAR_LEVELING_SN32_PAGE_SIZE 64 # endif #endif @@ -23,15 +23,15 @@ // The number of pages to use #ifndef WEAR_LEVELING_SN32_EMULATION_PAGE_COUNT # if defined(QMK_MCU_SERIES_SN32F240B) -# define WEAR_LEVELING_SN32_EMULATION_PAGE_COUNT 23 +# define WEAR_LEVELING_SN32_EMULATION_PAGE_COUNT 22 # elif defined(QMK_MCU_SERIES_SN32F260) -# define WEAR_LEVELING_SN32_EMULATION_PAGE_COUNT 23 +# define WEAR_LEVELING_SN32_EMULATION_PAGE_COUNT 22 # endif #endif // The origin of the emulated eeprom #ifndef WEAR_LEVELING_SN32_EMULATION_BASE_PAGE_ADDRESS -# define WEAR_LEVELING_SN32_EMULATION_BASE_PAGE_ADDRESS ((uint32_t)(WEAR_LEVELING_SN32_PAGE_SIZE * WEAR_LEVELING_SN32_EMULATION_TOTAL_PAGE - ((WEAR_LEVELING_SN32_EMULATION_PAGE_COUNT + 1) * WEAR_LEVELING_SN32_PAGE_SIZE))) +# define WEAR_LEVELING_SN32_EMULATION_BASE_PAGE_ADDRESS ((uint32_t)(WEAR_LEVELING_SN32_PAGE_SIZE * WEAR_LEVELING_SN32_EMULATION_TOTAL_PAGE - ((WEAR_LEVELING_SN32_EMULATION_PAGE_COUNT + 2) * WEAR_LEVELING_SN32_PAGE_SIZE))) #endif // 4-byte writes