pull/18/head
Jesse Vincent 9 years ago
parent 91e256a913
commit 181b84a572

@ -11,28 +11,28 @@ LEDControl BlinkyLights;
void set_keymap(Key keymapEntry, byte matrixStateEntry) { void set_keymap(Key keymapEntry, byte matrixStateEntry) {
// this logic sucks. there is a better way TODO this // this logic sucks. there is a better way TODO this
if (! (keymapEntry.flags ^ ( MOMENTARY | SWITCH_TO_KEYMAP))) { if (! (keymapEntry.flags ^ ( MOMENTARY | SWITCH_TO_KEYMAP))) {
if (key_toggled_on(matrixStateEntry)) { if (key_toggled_on(matrixStateEntry)) {
if ( keymapEntry.rawKey == KEYMAP_NEXT) { if ( keymapEntry.rawKey == KEYMAP_NEXT) {
temporary_keymap++; temporary_keymap++;
} else if ( keymapEntry.rawKey == KEYMAP_PREVIOUS) { } else if ( keymapEntry.rawKey == KEYMAP_PREVIOUS) {
temporary_keymap--; temporary_keymap--;
} else { } else {
temporary_keymap = keymapEntry.rawKey; temporary_keymap = keymapEntry.rawKey;
}
}
if (key_toggled_off(matrixStateEntry)) {
temporary_keymap = primary_keymap;
} }
}
if (key_toggled_off(matrixStateEntry)) {
temporary_keymap = primary_keymap;
}
} else if (! (keymapEntry.flags ^ ( SWITCH_TO_KEYMAP ))) { } else if (! (keymapEntry.flags ^ ( SWITCH_TO_KEYMAP ))) {
// switch keymap and stay there // switch keymap and stay there
if (key_toggled_on(matrixStateEntry)) { if (key_toggled_on(matrixStateEntry)) {
temporary_keymap = primary_keymap = keymapEntry.rawKey; temporary_keymap = primary_keymap = keymapEntry.rawKey;
Storage.save_primary_keymap(primary_keymap); Storage.save_primary_keymap(primary_keymap);
}
} }
}
} }
void scan_matrix() { void scan_matrix() {
@ -136,7 +136,7 @@ void handle_key_event(byte row, byte col) {
byte switchState = matrixState[row][col]; byte switchState = matrixState[row][col];
Key mappedKey = keymaps[temporary_keymap][row][col]; Key mappedKey = keymaps[temporary_keymap][row][col];
if (keymapEntry.flags & SWITCH_TO_KEYMAP) { if (keymaps[primary_keymap][row][col].flags & SWITCH_TO_KEYMAP) {
set_keymap(keymaps[primary_keymap][row][col], switchState); set_keymap(keymaps[primary_keymap][row][col], switchState);
} }
if (mappedKey.flags & SYNTHETIC_KEY) { if (mappedKey.flags & SYNTHETIC_KEY) {

@ -25,18 +25,18 @@ class LEDControl {
void set_led_mode(uint8_t mode); void set_led_mode(uint8_t mode);
private: private:
uint8_t led_mode; uint8_t led_mode;
uint8_t last_led_mode; uint8_t last_led_mode;
uint8_t stored_led_mode; uint8_t stored_led_mode;
static uint8_t pos; static uint8_t pos;
cRGB led_off = { .r = 0, .g = 0, .b = 0 }; cRGB led_off = { .r = 0, .g = 0, .b = 0 };
cRGB led_steady = { .r = 0, .g = 255, .b = 0}; cRGB led_steady = { .r = 0, .g = 255, .b = 0};
cRGB led_blue = { .r = 0, .g = 0, .b = 255 }; cRGB led_blue = { .r = 0, .g = 0, .b = 255 };
cRGB led_dark_blue = { .r = 0, .g = 0, .b = 127 }; cRGB led_dark_blue = { .r = 0, .g = 0, .b = 127 };
cRGB led_bright_red = { .r = 255, .g = 0, .b = 0}; cRGB led_bright_red = { .r = 255, .g = 0, .b = 0};
cRGB led_breathe; cRGB led_breathe;
cRGB rainbow; cRGB rainbow;
static uint8_t rainbow_hue; //stores 0 to 614 static uint8_t rainbow_hue; //stores 0 to 614

@ -3,7 +3,7 @@
#include "KeyboardConfig.h" #include "KeyboardConfig.h"
class KeyboardStorage { class KeyboardStorage {
public: public:
uint8_t load_primary_keymap(); uint8_t load_primary_keymap();
void save_primary_keymap(uint8_t keymap); void save_primary_keymap(uint8_t keymap);
}; };

Loading…
Cancel
Save