Merge pull request #63 from algernon/f/macros/convenience-macros

A few convenience macros
pull/65/head
Jesse Vincent 8 years ago committed by GitHub
commit f20e1bbd15

@ -13,10 +13,14 @@ typedef uint8_t macro_t;
#define MACRO_NONE 0 #define MACRO_NONE 0
#define MACRO(...) ({static const macro_t __m[] PROGMEM = { __VA_ARGS__ }; &__m[0]; }) #define MACRO(...) ({static const macro_t __m[] PROGMEM = { __VA_ARGS__ }; &__m[0]; })
#define MACRODOWN(...) (key_toggled_on(keyState) ? MACRO(__VA_ARGS__) : MACRO_NONE)
#define I(n) MACRO_ACTION_STEP_INTERVAL, n #define I(n) MACRO_ACTION_STEP_INTERVAL, n
#define W(n) MACRO_ACTION_STEP_WAIT, n #define W(n) MACRO_ACTION_STEP_WAIT, n
#define D(k) MACRO_ACTION_STEP_KEYDOWN, (Key_ ## k).flags, (Key_ ## k).rawKey #define Dr(k) MACRO_ACTION_STEP_KEYDOWN, (k).flags, (k).rawKey
#define U(k) MACRO_ACTION_STEP_KEYUP, (Key_ ## k).flags, (Key_ ## k).rawKey #define D(k) Dr(Key_ ## k)
#define T(k) D(k), U(k) #define Ur(k) MACRO_ACTION_STEP_KEYUP, (k).flags, (k).rawKey
#define END MACRO_ACTION_END #define U(k) Ur(Key_ ## k)
#define Tr(k) Dr(k), Ur(k)
#define T(k) D(k), U(k)
#define END MACRO_ACTION_END

Loading…
Cancel
Save