summaryrefslogtreecommitdiff
path: root/tmk_core/common
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common')
-rw-r--r--tmk_core/common/chibios/eeprom_stm32.c12
-rw-r--r--tmk_core/common/chibios/flash_stm32.c31
-rw-r--r--tmk_core/common/chibios/flash_stm32.h1
-rw-r--r--tmk_core/common/test/flash_stm32_mock.c1
4 files changed, 6 insertions, 39 deletions
diff --git a/tmk_core/common/chibios/eeprom_stm32.c b/tmk_core/common/chibios/eeprom_stm32.c
index 5bf852fde1..64d7d79ba0 100644
--- a/tmk_core/common/chibios/eeprom_stm32.c
+++ b/tmk_core/common/chibios/eeprom_stm32.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdbool.h>
+#include "util.h"
#include "debug.h"
#include "eeprom_stm32.h"
#include "flash_stm32.h"
@@ -188,9 +189,6 @@
# endif
#endif
-#define FEE_XSTR(x) FEE_STR(x)
-#define FEE_STR(x) #x
-
/* Size of combined compacted eeprom and write log pages */
#define FEE_DENSITY_MAX_SIZE (FEE_DENSITY_PAGES * FEE_PAGE_SIZE)
/* Addressable range 16KByte: 0 <-> (0x1FFF << 1) */
@@ -198,7 +196,7 @@
#ifndef EEPROM_START_ADDRESS /* *TODO: Get rid of this check */
# if FEE_DENSITY_MAX_SIZE > (FEE_MCU_FLASH_SIZE * 1024)
-# pragma message FEE_XSTR(FEE_DENSITY_MAX_SIZE) " > " FEE_XSTR(FEE_MCU_FLASH_SIZE * 1024)
+# pragma message STR(FEE_DENSITY_MAX_SIZE) " > " STR(FEE_MCU_FLASH_SIZE * 1024)
# error emulated eeprom: FEE_DENSITY_PAGES is greater than available flash size
# endif
#endif
@@ -206,15 +204,15 @@
/* Size of emulated eeprom */
#ifdef FEE_DENSITY_BYTES
# if (FEE_DENSITY_BYTES > FEE_DENSITY_MAX_SIZE)
-# pragma message FEE_XSTR(FEE_DENSITY_BYTES) " > " FEE_XSTR(FEE_DENSITY_MAX_SIZE)
+# pragma message STR(FEE_DENSITY_BYTES) " > " STR(FEE_DENSITY_MAX_SIZE)
# error emulated eeprom: FEE_DENSITY_BYTES exceeds FEE_DENSITY_MAX_SIZE
# endif
# if (FEE_DENSITY_BYTES == FEE_DENSITY_MAX_SIZE)
-# pragma message FEE_XSTR(FEE_DENSITY_BYTES) " == " FEE_XSTR(FEE_DENSITY_MAX_SIZE)
+# pragma message STR(FEE_DENSITY_BYTES) " == " STR(FEE_DENSITY_MAX_SIZE)
# warning emulated eeprom: FEE_DENSITY_BYTES leaves no room for a write log. This will greatly increase the flash wear rate!
# endif
# if FEE_DENSITY_BYTES > FEE_ADDRESS_MAX_SIZE
-# pragma message FEE_XSTR(FEE_DENSITY_BYTES) " > " FEE_XSTR(FEE_ADDRESS_MAX_SIZE)
+# pragma message STR(FEE_DENSITY_BYTES) " > " STR(FEE_ADDRESS_MAX_SIZE)
# error emulated eeprom: FEE_DENSITY_BYTES is greater than FEE_ADDRESS_MAX_SIZE allows
# endif
# if ((FEE_DENSITY_BYTES) % 2) == 1
diff --git a/tmk_core/common/chibios/flash_stm32.c b/tmk_core/common/chibios/flash_stm32.c
index 66f2b13768..6b80ff71c3 100644
--- a/tmk_core/common/chibios/flash_stm32.c
+++ b/tmk_core/common/chibios/flash_stm32.c
@@ -16,22 +16,7 @@
* Modifications for QMK and STM32F303 by Yiancar
*/
-#if defined(EEPROM_EMU_STM32F303xC)
-# define STM32F303xC
-# include "stm32f3xx.h"
-#elif defined(EEPROM_EMU_STM32F103xB)
-# define STM32F103xB
-# include "stm32f1xx.h"
-#elif defined(EEPROM_EMU_STM32F072xB)
-# define STM32F072xB
-# include "stm32f0xx.h"
-#elif defined(EEPROM_EMU_STM32F042x6)
-# define STM32F042x6
-# include "stm32f0xx.h"
-#else
-# error "not implemented."
-#endif
-
+#include <hal.h>
#include "flash_stm32.h"
#if defined(EEPROM_EMU_STM32F103xB)
@@ -177,17 +162,3 @@ void FLASH_Lock(void) {
/* Set the Lock Bit to lock the FPEC and the FCR */
FLASH->CR |= FLASH_CR_LOCK;
}
-
-/**
- * @brief Clears the FLASH's pending flags.
- * @param FLASH_FLAG: specifies the FLASH flags to clear.
- * This parameter can be any combination of the following values:
- * @arg FLASH_FLAG_PGERR: FLASH Programming error flag flag
- * @arg FLASH_FLAG_WRPERR: FLASH Write protected error flag
- * @arg FLASH_FLAG_EOP: FLASH End of Programming flag
- * @retval None
- */
-void FLASH_ClearFlag(uint32_t FLASH_FLAG) {
- /* Clear the flags */
- FLASH->SR = FLASH_FLAG;
-}
diff --git a/tmk_core/common/chibios/flash_stm32.h b/tmk_core/common/chibios/flash_stm32.h
index 9c6a7cc50f..6c66642ec5 100644
--- a/tmk_core/common/chibios/flash_stm32.h
+++ b/tmk_core/common/chibios/flash_stm32.h
@@ -38,7 +38,6 @@ FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data);
void FLASH_Unlock(void);
void FLASH_Lock(void);
-void FLASH_ClearFlag(uint32_t FLASH_FLAG);
#ifdef __cplusplus
}
diff --git a/tmk_core/common/test/flash_stm32_mock.c b/tmk_core/common/test/flash_stm32_mock.c
index 1b81d81f9a..222a004bc7 100644
--- a/tmk_core/common/test/flash_stm32_mock.c
+++ b/tmk_core/common/test/flash_stm32_mock.c
@@ -47,4 +47,3 @@ FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data) {
FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout) { return FLASH_COMPLETE; }
void FLASH_Unlock(void) { flash_locked = false; }
void FLASH_Lock(void) { flash_locked = true; }
-void FLASH_ClearFlag(uint32_t FLASH_FLAG) {}