Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing parentheses to some important macros #4775

Merged
merged 2 commits into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions quantum/quantum_keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,8 @@ enum quantum_keycodes {
#define SWIN(kc) SGUI(kc)
#define LCA(kc) (QK_LCTL | QK_LALT | (kc))

#define MOD_HYPR 0xf
#define MOD_MEH 0x7

#define MOD_HYPR 0xF
#define MOD_MEH 0x7

// Aliases for shifted symbols
// Each key has a 4-letter code, and some have longer aliases too.
Expand Down Expand Up @@ -601,7 +600,7 @@ enum quantum_keycodes {
#define RGB_M_T RGB_MODE_RGBTEST

// L-ayer, T-ap - 256 keycode max, 16 layer max
#define LT(layer, kc) (QK_LAYER_TAP | ((layer & 0xF) << 8) | ((kc) & 0xFF))
#define LT(layer, kc) (QK_LAYER_TAP | (((layer) & 0xF) << 8) | ((kc) & 0xFF))

#define AG_SWAP MAGIC_SWAP_ALT_GUI
#define AG_NORM MAGIC_UNSWAP_ALT_GUI
Expand All @@ -615,28 +614,28 @@ enum quantum_keycodes {
// In fact, we changed it to assume ON_PRESS for sanity/simplicity. If needed, you can add your own
// keycode modeled after the old version, kept below for this.
/* #define TO(layer, when) (QK_TO | (when << 0x4) | (layer & 0xFF)) */
#define TO(layer) (QK_TO | (ON_PRESS << 0x4) | (layer & 0xFF))
#define TO(layer) (QK_TO | (ON_PRESS << 0x4) | ((layer) & 0xFF))

// Momentary switch layer - 256 layer max
#define MO(layer) (QK_MOMENTARY | (layer & 0xFF))
#define MO(layer) (QK_MOMENTARY | ((layer) & 0xFF))

// Set default layer - 256 layer max
#define DF(layer) (QK_DEF_LAYER | (layer & 0xFF))
#define DF(layer) (QK_DEF_LAYER | ((layer) & 0xFF))

// Toggle to layer - 256 layer max
#define TG(layer) (QK_TOGGLE_LAYER | (layer & 0xFF))
#define TG(layer) (QK_TOGGLE_LAYER | ((layer) & 0xFF))

// One-shot layer - 256 layer max
#define OSL(layer) (QK_ONE_SHOT_LAYER | (layer & 0xFF))
#define OSL(layer) (QK_ONE_SHOT_LAYER | ((layer) & 0xFF))

// L-ayer M-od: Momentary switch layer with modifiers active - 16 layer max, left mods only
#define LM(layer, mod) (QK_LAYER_MOD | ((layer & 0xF) << 4) | ((mod) & 0xF))
#define LM(layer, mod) (QK_LAYER_MOD | (((layer) & 0xF) << 4) | ((mod) & 0xF))

// One-shot mod
#define OSM(mod) (QK_ONE_SHOT_MOD | ((mod) & 0xFF))

// Layer tap-toggle
#define TT(layer) (QK_LAYER_TAP_TOGGLE | (layer & 0xFF))
#define TT(layer) (QK_LAYER_TAP_TOGGLE | ((layer) & 0xFF))

// M-od, T-ap - 256 keycode max
#define MT(mod, kc) (QK_MOD_TAP | (((mod) & 0x1F) << 8) | ((kc) & 0xFF))
Expand Down
6 changes: 3 additions & 3 deletions tmk_core/common/progmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# include <avr/pgmspace.h>
#else
# define PROGMEM
# define pgm_read_byte(p) *((unsigned char*)p)
# define pgm_read_word(p) *((uint16_t*)p)
# define pgm_read_dword(p) *((uint32_t*)p)
# define pgm_read_byte(p) *((unsigned char*)(p))
# define pgm_read_word(p) *((uint16_t*)(p))
# define pgm_read_dword(p) *((uint32_t*)(p))
vomindoraan marked this conversation as resolved.
Show resolved Hide resolved
#endif

#endif