Merge pull request #1 from keyboardio/f/positions

Make the macros aware of the row/col they were pressed at
pull/365/head
Jesse Vincent 8 years ago committed by GitHub
commit ae762ee9c7

@ -5,6 +5,8 @@ const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
return MACRO_NONE; return MACRO_NONE;
} }
byte Macros_::row, Macros_::col;
void Macros_::play(const macro_t *macro_p) { void Macros_::play(const macro_t *macro_p) {
macro_t macro = END; macro_t macro = END;
uint8_t interval = 0; uint8_t interval = 0;
@ -51,6 +53,8 @@ static Key handleMacroEvent(Key mappedKey, byte row, byte col, uint8_t keyState)
if (!key_toggled_on(keyState)) if (!key_toggled_on(keyState))
return Key_NoKey; return Key_NoKey;
Macros_::row = row;
Macros_::col = col;
const macro_t *m = macroAction(mappedKey.keyCode, keyState); const macro_t *m = macroAction(mappedKey.keyCode, keyState);
Macros.play(m); Macros.play(m);

@ -14,6 +14,8 @@ class Macros_ : public KeyboardioPlugin {
virtual void begin(void) final; virtual void begin(void) final;
void play(const macro_t *macro_p); void play(const macro_t *macro_p);
static byte row, col;
}; };
extern Macros_ Macros; extern Macros_ Macros;

Loading…
Cancel
Save