From f0a191d6b1e3d0a36dd0fde5837ebe5e1907f3c2 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 5 Feb 2017 08:54:52 +0100 Subject: [PATCH 1/2] Drop keymap_metadata.h It had the COLS & ROWS defines, which are hardware-specific, and were moved to the hardware lib. Signed-off-by: Gergely Nagy --- src/key_events.h | 2 +- src/keymap_metadata.h | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 100644 src/keymap_metadata.h diff --git a/src/key_events.h b/src/key_events.h index 2a90f923..57514ab8 100644 --- a/src/key_events.h +++ b/src/key_events.h @@ -2,10 +2,10 @@ #include #include "KeyboardioHID.h" +#include KEYBOARDIO_HARDWARE_H #include "key_defs.h" #include "keyswitch_state.h" #include "Storage.h" -#include "keymap_metadata.h" #include "hooks.h" extern const Key keymaps[][ROWS][COLS]; diff --git a/src/keymap_metadata.h b/src/keymap_metadata.h deleted file mode 100644 index 81207eba..00000000 --- a/src/keymap_metadata.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -#define COLS 16 -#define ROWS 4 From 8d768e12a7e554c54bb91e0a24687d1f42d70190 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Sun, 5 Feb 2017 09:05:39 +0100 Subject: [PATCH 2/2] Move Storage to the hardware library too Signed-off-by: Gergely Nagy --- src/KeyboardioFirmware.cpp | 2 +- src/Storage.cpp | 19 ------------------- src/Storage.h | 15 --------------- src/key_events.h | 1 - 4 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 src/Storage.cpp delete mode 100644 src/Storage.h diff --git a/src/KeyboardioFirmware.cpp b/src/KeyboardioFirmware.cpp index d6e02f29..3e1c8065 100644 --- a/src/KeyboardioFirmware.cpp +++ b/src/KeyboardioFirmware.cpp @@ -16,7 +16,7 @@ Keyboardio_::setup(const byte keymap_count) { event_handler_hook_use (NULL); loop_hook_use (NULL); - Layer.defaultLayer (Storage.load_primary_keymap (keymap_count)); + Layer.defaultLayer (KeyboardHardware.load_primary_layer (keymap_count)); } custom_loop_t loopHooks[HOOK_MAX]; diff --git a/src/Storage.cpp b/src/Storage.cpp deleted file mode 100644 index 882fef85..00000000 --- a/src/Storage.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "Storage.h" - - -Storage_::Storage_(void) { -} - -void Storage_::save_primary_keymap(uint8_t keymap) { - EEPROM.write(EEPROM_KEYMAP_LOCATION, keymap); -} - -uint8_t Storage_::load_primary_keymap(uint8_t keymap_count) { - uint8_t keymap = EEPROM.read(EEPROM_KEYMAP_LOCATION); - if (keymap >= keymap_count) { - return 0; // undefined positions get saved as 255 - } - return 0; // return keymap; -} - -Storage_ Storage; diff --git a/src/Storage.h b/src/Storage.h deleted file mode 100644 index 03caf182..00000000 --- a/src/Storage.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include -#include - -#define EEPROM_KEYMAP_LOCATION 0 - -class Storage_ { - public: - Storage_(void); - uint8_t load_primary_keymap(uint8_t keymap_count); - void save_primary_keymap(uint8_t keymap); -}; - -extern Storage_ Storage; diff --git a/src/key_events.h b/src/key_events.h index 57514ab8..5ee039bc 100644 --- a/src/key_events.h +++ b/src/key_events.h @@ -5,7 +5,6 @@ #include KEYBOARDIO_HARDWARE_H #include "key_defs.h" #include "keyswitch_state.h" -#include "Storage.h" #include "hooks.h" extern const Key keymaps[][ROWS][COLS];