summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPurdea Andrei <andrei@purdea.ro>2021-04-25 11:57:49 +0300
committerGitHub <noreply@github.com>2021-04-25 18:57:49 +1000
commit412e7a03e49d044a2dea0fb38b05fb24c8d6eabe (patch)
treee7de86f5551a638a335cc46aadfc3f59ec9d4802
parent23e70fa857b295ded37d1989eab4556d64477ff0 (diff)
eeprom driver: Refactor where eeprom driver initialisation (and EEPROM emulation initialisation) occurs to make it non-target-specific. (#12671)
-rw-r--r--tmk_core/common/keyboard.c12
-rw-r--r--tmk_core/protocol/chibios/main.c13
2 files changed, 12 insertions, 13 deletions
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c
index 132affe7a8..24baf41c00 100644
--- a/tmk_core/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
@@ -94,6 +94,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef DIP_SWITCH_ENABLE
# include "dip_switch.h"
#endif
+#ifdef STM32_EEPROM_ENABLE
+# include "eeprom_stm32.h"
+#endif
+#ifdef EEPROM_DRIVER
+# include "eeprom_driver.h"
+#endif
static uint32_t last_input_modification_time = 0;
uint32_t last_input_activity_time(void) { return last_input_modification_time; }
@@ -231,6 +237,12 @@ void keyboard_setup(void) {
disable_jtag();
#endif
print_set_sendchar(sendchar);
+#ifdef STM32_EEPROM_ENABLE
+ EEPROM_Init();
+#endif
+#ifdef EEPROM_DRIVER
+ eeprom_driver_init();
+#endif
matrix_setup();
keyboard_pre_init_kb();
}
diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c
index 63e4c99d21..e2ec011186 100644
--- a/tmk_core/protocol/chibios/main.c
+++ b/tmk_core/protocol/chibios/main.c
@@ -51,12 +51,6 @@
#ifdef MIDI_ENABLE
# include "qmk_midi.h"
#endif
-#ifdef STM32_EEPROM_ENABLE
-# include "eeprom_stm32.h"
-#endif
-#ifdef EEPROM_DRIVER
-# include "eeprom_driver.h"
-#endif
#include "suspend.h"
#include "wait.h"
@@ -150,13 +144,6 @@ int main(void) {
halInit();
chSysInit();
-#ifdef STM32_EEPROM_ENABLE
- EEPROM_Init();
-#endif
-#ifdef EEPROM_DRIVER
- eeprom_driver_init();
-#endif
-
// TESTING
// chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);