Macros: Introduce a few more convenience macros

`Dr`, `Ur`, and `Tr` are similar to the already existing `D`, `U`, and
`T` helpers, but they do not prefix their argument with `Key_`. This
makes it a lot easier to create macros that use custom key codes.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/63/head
Gergely Nagy 8 years ago
parent cce029c34e
commit e510970291

@ -14,9 +14,12 @@ typedef uint8_t macro_t;
#define MACRO_NONE 0
#define MACRO(...) ({static const macro_t __m[] PROGMEM = { __VA_ARGS__ }; &__m[0]; })
#define I(n) MACRO_ACTION_STEP_INTERVAL, n
#define W(n) MACRO_ACTION_STEP_WAIT, n
#define D(k) MACRO_ACTION_STEP_KEYDOWN, (Key_ ## k).flags, (Key_ ## k).rawKey
#define U(k) MACRO_ACTION_STEP_KEYUP, (Key_ ## k).flags, (Key_ ## k).rawKey
#define T(k) D(k), U(k)
#define END MACRO_ACTION_END
#define I(n) MACRO_ACTION_STEP_INTERVAL, n
#define W(n) MACRO_ACTION_STEP_WAIT, n
#define Dr(k) MACRO_ACTION_STEP_KEYDOWN, (k).flags, (k).rawKey
#define D(k) Dr(Key_ ## k)
#define Ur(k) MACRO_ACTION_STEP_KEYUP, (k).flags, (k).rawKey
#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