aboutsummaryrefslogtreecommitdiffstats
path: root/tmk_core/common/action.c
diff options
context:
space:
mode:
authorAlex Ong <the.onga@gmail.com>2019-05-18 06:47:50 +1000
committerDrashna Jaelre <drashna@live.com>2019-05-17 13:47:50 -0700
commit00d1d7828c63538122d9d3db7336b9a40c9ffe80 (patch)
treee1d055c72f23bbdc6e30ee7e3eb1213857e2ae33 /tmk_core/common/action.c
parent90a45aac6e8fdbf8d781d711bb6a27574130ff38 (diff)
downloadfirmware-00d1d7828c63538122d9d3db7336b9a40c9ffe80.tar.gz
firmware-00d1d7828c63538122d9d3db7336b9a40c9ffe80.tar.bz2
firmware-00d1d7828c63538122d9d3db7336b9a40c9ffe80.zip
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.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index bb4e66c9c..3991a8a9e 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;