3 ms·
Here's a helpful little snippet for fellow QMK warriors: #define SEND(case_enum, string) \ case case_enum:\ if (record -> event.pressed) {\
by samatman 6y ago
Here's a helpful little snippet for fellow QMK warriors:
#define SEND(case_enum, string) \
case case_enum:\
if (record -> event.pressed) {\
SEND_STRING(string);\
}\
return false;\
break
Looking at the OP article, I don't know if the `return false;` is really necessary? I copied it from elsewhere.
This lets you just say `SEND(MIC_MUTE, SS_LCTL(SS_LALT(SS_LSFT(SS_TAP(X_F10))));` or what have you.
I left off the final semicolon because it looks more natural to me.
- TheSoftwareGuy 6y agoLooks useful! Pro tip, as a professional C/C++ dev, for macros: Wrap the body in a do-while loop, to force a semicolon after it’s called https://stackoverflow.com/questions/1067226/c-multi-line-macro-do-while0-vs-scope-block#1067238 https://stackoverflow.com/questions/1067226/c-multi-line-mac...
- account42 6y agoThat wouldn't work here (well it wouldn't without the return) as that would mean the break would apply to the loop and not the switch statement. In genereal, I think hiding control flow in macros is a bad idea.