make astyle

pull/389/head
Jesse Vincent 8 years ago
parent 1d2719dc98
commit f2ee554ce6
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -23,47 +23,47 @@
const Key keymaps[][ROWS][COLS] PROGMEM = {
[0] = KEYMAP_STACKED
(
M(0), Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
[0] = KEYMAP_STACKED
(
M(0), Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey,
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab,
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G,
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
Key_NoKey,
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
Key_NoKey,
Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip,
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip,
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey
),
Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl,
Key_NoKey
),
};
const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
if (macroIndex == 0 && key_toggled_off (keyState)) {
EEPROMKeymapProgrammer.nextState ();
}
if (macroIndex == 0 && key_toggled_off (keyState)) {
EEPROMKeymapProgrammer.nextState ();
}
return MACRO_NONE;
return MACRO_NONE;
}
void setup () {
Serial.begin (9600);
Serial.begin (9600);
Kaleidoscope.setup ();
Kaleidoscope.setup ();
USE_PLUGINS (&EEPROMKeymapProgrammer, &EEPROMKeymap, &Macros);
USE_PLUGINS (&EEPROMKeymapProgrammer, &EEPROMKeymap, &Macros);
Layer.getKey = EEPROMKeymap.getKey;
Layer.getKey = EEPROMKeymap.getKey;
EEPROMKeymap.reserveSpace (1);
EEPROMSettings.seal ();
EEPROMKeymap.reserveSpace (1);
EEPROMSettings.seal ();
}
void loop () {
Kaleidoscope.loop ();
Kaleidoscope.loop ();
}

@ -19,91 +19,91 @@
#include <Kaleidoscope-EEPROM-Keymap-Programmer.h>
namespace KaleidoscopePlugins {
uint16_t EEPROMKeymapProgrammer::updatePosition;
EEPROMKeymapProgrammer::state_t EEPROMKeymapProgrammer::state;
EEPROMKeymapProgrammer::mode_t EEPROMKeymapProgrammer::mode;
Key EEPROMKeymapProgrammer::newKey;
uint16_t EEPROMKeymapProgrammer::updatePosition;
EEPROMKeymapProgrammer::state_t EEPROMKeymapProgrammer::state;
EEPROMKeymapProgrammer::mode_t EEPROMKeymapProgrammer::mode;
Key EEPROMKeymapProgrammer::newKey;
EEPROMKeymapProgrammer::EEPROMKeymapProgrammer (void) {
}
EEPROMKeymapProgrammer::EEPROMKeymapProgrammer (void) {
}
void
EEPROMKeymapProgrammer::begin (void) {
void
EEPROMKeymapProgrammer::begin (void) {
event_handler_hook_use (eventHandlerHook);
}
}
void
EEPROMKeymapProgrammer::nextState (void) {
void
EEPROMKeymapProgrammer::nextState (void) {
switch (state) {
case INACTIVE:
state = WAIT_FOR_KEY;
break;
state = WAIT_FOR_KEY;
break;
case WAIT_FOR_KEY:
if (mode == CODE)
state = WAIT_FOR_CODE;
else
state = WAIT_FOR_SOURCE_KEY;
break;
if (mode == CODE)
state = WAIT_FOR_CODE;
else
state = WAIT_FOR_SOURCE_KEY;
break;
case WAIT_FOR_CODE:
case WAIT_FOR_SOURCE_KEY:
::EEPROMKeymap.updateKey (updatePosition, newKey);
cancel ();
break;
::EEPROMKeymap.updateKey (updatePosition, newKey);
cancel ();
break;
}
}
}
void
EEPROMKeymapProgrammer::cancel (void) {
void
EEPROMKeymapProgrammer::cancel (void) {
updatePosition = 0;
newKey = Key_NoKey;
state = INACTIVE;
}
}
Key
EEPROMKeymapProgrammer::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
Key
EEPROMKeymapProgrammer::eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState) {
if (state == INACTIVE)
return mappedKey;
return mappedKey;
if (state == WAIT_FOR_KEY) {
if (key_toggled_on (keyState)) {
updatePosition = Layer.top () * ROWS * COLS + row * COLS + col;
}
if (key_toggled_off (keyState)) {
if ((uint16_t)(Layer.top () * ROWS * COLS + row * COLS + col) == updatePosition)
nextState ();
}
return Key_NoKey;
if (key_toggled_on (keyState)) {
updatePosition = Layer.top () * ROWS * COLS + row * COLS + col;
}
if (key_toggled_off (keyState)) {
if ((uint16_t)(Layer.top () * ROWS * COLS + row * COLS + col) == updatePosition)
nextState ();
}
return Key_NoKey;
}
if (state == WAIT_FOR_SOURCE_KEY) {
if (key_toggled_on (keyState)) {
newKey = Layer.getKeyFromPROGMEM (Layer.top (), row, col);
}
if (key_toggled_off (keyState)) {
if (newKey == Layer.getKeyFromPROGMEM (Layer.top (), row, col))
nextState ();
}
return Key_NoKey;
if (key_toggled_on (keyState)) {
newKey = Layer.getKeyFromPROGMEM (Layer.top (), row, col);
}
if (key_toggled_off (keyState)) {
if (newKey == Layer.getKeyFromPROGMEM (Layer.top (), row, col))
nextState ();
}
return Key_NoKey;
}
// WAIT_FOR_CODE state
if (mappedKey < Key_1 || mappedKey > Key_0)
return mappedKey;
return mappedKey;
if (!key_toggled_on (keyState))
return Key_NoKey;
return Key_NoKey;
uint8_t n;
if (mappedKey.keyCode == Key_0.keyCode)
n = 0;
n = 0;
else
n = mappedKey.keyCode - Key_1.keyCode + 1;
n = mappedKey.keyCode - Key_1.keyCode + 1;
newKey.raw = newKey.raw * 10 + n;
return Key_NoKey;
}
}
};

@ -22,11 +22,11 @@
#include <Kaleidoscope-EEPROM-Keymap.h>
namespace KaleidoscopePlugins {
class EEPROMKeymapProgrammer : public KaleidoscopePlugin {
class EEPROMKeymapProgrammer : public KaleidoscopePlugin {
public:
typedef enum {
CODE,
COPY,
CODE,
COPY,
} mode_t;
static mode_t mode;
@ -39,10 +39,10 @@ namespace KaleidoscopePlugins {
private:
typedef enum {
INACTIVE,
WAIT_FOR_KEY,
WAIT_FOR_CODE,
WAIT_FOR_SOURCE_KEY,
INACTIVE,
WAIT_FOR_KEY,
WAIT_FOR_CODE,
WAIT_FOR_SOURCE_KEY,
} state_t;
static state_t state;
@ -50,7 +50,7 @@ namespace KaleidoscopePlugins {
static Key newKey;
static Key eventHandlerHook (Key mappedKey, byte row, byte col, uint8_t keyState);
};
};
};
extern KaleidoscopePlugins::EEPROMKeymapProgrammer EEPROMKeymapProgrammer;

Loading…
Cancel
Save