diff options
author | Alex Ong <the.onga@gmail.com> | 2019-05-18 06:47:50 +1000 |
---|---|---|
committer | Florian Didron <fdidron@users.noreply.github.com> | 2019-07-27 11:25:58 +0900 |
commit | 8253427f12bea961443bb0cb1c22171a4ccd8db0 (patch) | |
tree | c99a59f1691b86e6aa8622f6e9dc57236c7e750a /tmk_core/common/action.c | |
parent | aa482e2e4ffbb9747a18b0d5e6e6b2e610619484 (diff) |
Typedef'ed layer_state_t to uint32_t (#3637)
* Typedef'ed layer_state_t to uint32_t.
This enables future work with layer_state_t to uint8_t for optimization purposes.
* Removed accidental xeal60 commit
* Revert to egyptian brackets, added sizeof(layer_state_t) so when layer_state_t is redefined it will automagically work.
* Add additional typedefs
* Add checks for setting layer state
* Update tmk_core/common/action_layer.h
Co-Authored-By: alex-ong <the.onga@gmail.com>
* Revert commit.
Diffstat (limited to 'tmk_core/common/action.c')
-rw-r--r-- | tmk_core/common/action.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index c74121d06d..285786cb7c 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -406,8 +406,8 @@ void process_action(keyrecord_t *record, action_t action) /* Default Layer Bitwise Operation */ if (!event.pressed) { uint8_t shift = action.layer_bitop.part*4; - uint32_t bits = ((uint32_t)action.layer_bitop.bits)<<shift; - uint32_t mask = (action.layer_bitop.xbit) ? ~(((uint32_t)0xf)<<shift) : 0; + layer_state_t bits = ((layer_state_t)action.layer_bitop.bits)<<shift; + layer_state_t mask = (action.layer_bitop.xbit) ? ~(((layer_state_t)0xf)<<shift) : 0; switch (action.layer_bitop.op) { case OP_BIT_AND: default_layer_and(bits | mask); break; case OP_BIT_OR: default_layer_or(bits | mask); break; @@ -420,8 +420,8 @@ void process_action(keyrecord_t *record, action_t action) if (event.pressed ? (action.layer_bitop.on & ON_PRESS) : (action.layer_bitop.on & ON_RELEASE)) { uint8_t shift = action.layer_bitop.part*4; - uint32_t bits = ((uint32_t)action.layer_bitop.bits)<<shift; - uint32_t mask = (action.layer_bitop.xbit) ? ~(((uint32_t)0xf)<<shift) : 0; + layer_state_t bits = ((layer_state_t)action.layer_bitop.bits)<<shift; + layer_state_t mask = (action.layer_bitop.xbit) ? ~(((layer_state_t)0xf)<<shift) : 0; switch (action.layer_bitop.op) { case OP_BIT_AND: layer_and(bits | mask); break; case OP_BIT_OR: layer_or(bits | mask); break; |