Skip to content

Commit

Permalink
Rename SN32 WL driver, guard the last page
Browse files Browse the repository at this point in the history
  • Loading branch information
Jpe230 committed Oct 12, 2022
1 parent 40a8d85 commit 77f358d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions builddefs/common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)),)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion keyboards/handwired/onekey/sn32/rules.mk
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
EEPROM_DRIVER = wear_leveling
WEAR_LEVELING_DRIVER = sn32
WEAR_LEVELING_DRIVER = sn32_flash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 77f358d

Please sign in to comment.