From f1da7437fa08d93b57c4927d75fc2b2e30a87637 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Mon, 25 Jan 2016 23:58:16 -0800 Subject: [PATCH] Break out storage related functions into their own file --- KeyboardioFirmware.ino | 16 ---------------- storage.cpp | 14 ++++++++++++++ storage.h | 6 ++++++ 3 files changed, 20 insertions(+), 16 deletions(-) create mode 100644 storage.cpp create mode 100644 storage.h diff --git a/KeyboardioFirmware.ino b/KeyboardioFirmware.ino index 5669be16..a2fc336b 100644 --- a/KeyboardioFirmware.ino +++ b/KeyboardioFirmware.ino @@ -127,22 +127,6 @@ void loop() { -void save_primary_keymap(byte keymap) { - EEPROM.write(EEPROM_KEYMAP_LOCATION, keymap); -} - -byte load_primary_keymap() { - byte keymap = EEPROM.read(EEPROM_KEYMAP_LOCATION); - if (keymap >= KEYMAPS ) { - return 0; // undefined positions get saved as 255 - } - return 0; // return keymap; -} - - - - - // Sending events to the usb host void handle_synthetic_key_press(byte switchState, Key mappedKey) { diff --git a/storage.cpp b/storage.cpp new file mode 100644 index 00000000..32c354c9 --- /dev/null +++ b/storage.cpp @@ -0,0 +1,14 @@ +#include "storage.h" + +void save_primary_keymap(byte keymap) { + EEPROM.write(EEPROM_KEYMAP_LOCATION, keymap); +} + +byte load_primary_keymap() { + byte keymap = EEPROM.read(EEPROM_KEYMAP_LOCATION); + if (keymap >= KEYMAPS ) { + return 0; // undefined positions get saved as 255 + } + return 0; // return keymap; +} + diff --git a/storage.h b/storage.h new file mode 100644 index 00000000..a6db42fe --- /dev/null +++ b/storage.h @@ -0,0 +1,6 @@ +#include +#include +#include "KeyboardConfig.h" + +void save_primary_keymap(byte keymap); +byte load_primary_keymap();