Cleaner separation for our 'Storage' class

pull/18/head
Jesse Vincent 9 years ago
parent 13954d0165
commit 79dfa290c7

@ -5,7 +5,6 @@
#include "KeyboardioSX1509.h"
#define USE_HSV_CURVE 1
#define EEPROM_KEYMAP_LOCATION 0
#define RIGHT_COLS 8

@ -1,8 +1,6 @@
#pragma once
#include <Arduino.h>
//add your includes for the project KeyboardIO here
#include <EEPROM.h>
//end of add your includes here
#ifdef __cplusplus

@ -39,7 +39,7 @@ void setup() {
LEDControl.boot_animation();
implementation_pins_setup();
temporary_keymap = primary_keymap = Storage.load_primary_keymap();
temporary_keymap = primary_keymap = Storage.load_primary_keymap(KEYMAPS);
}

@ -1,4 +1,4 @@
#include "storage.h"
#include "Storage.h"
Storage_::Storage_(void) {
@ -8,9 +8,9 @@ void Storage_::save_primary_keymap(uint8_t keymap) {
EEPROM.write(EEPROM_KEYMAP_LOCATION, keymap);
}
uint8_t Storage_::load_primary_keymap() {
uint8_t Storage_::load_primary_keymap(uint8_t keymap_count) {
uint8_t keymap = EEPROM.read(EEPROM_KEYMAP_LOCATION);
if (keymap >= KEYMAPS ) {
if (keymap >= keymap_count) {
return 0; // undefined positions get saved as 255
}
return 0; // return keymap;

@ -2,12 +2,13 @@
#include <Arduino.h>
#include <EEPROM.h>
#include "KeyboardConfig.h"
#define EEPROM_KEYMAP_LOCATION 0
class Storage_ {
public:
Storage_(void);
uint8_t load_primary_keymap(void);
uint8_t load_primary_keymap(uint8_t keymap_count);
void save_primary_keymap(uint8_t keymap);
};

@ -5,8 +5,7 @@
#include "matrix_state.h"
#include "MouseWrapper.h"
#include "LEDControl.h"
#include "storage.h"
#include "Storage.h"
extern uint8_t matrixState[ROWS][COLS];
extern const Key keymaps[KEYMAPS][ROWS][COLS];

Loading…
Cancel
Save