From: tmk Date: Thu, 26 Oct 2017 05:37:52 +0000 (+0900) Subject: core: Fix doc/keymap.md for bitwise operation X-Git-Url: https://git.gir.st/tmk_keyboard.git/commitdiff_plain/41905715c29bd29ce85f5b83ca47462e11bf87cd core: Fix doc/keymap.md for bitwise operation --- diff --git a/tmk_core/doc/keymap.md b/tmk_core/doc/keymap.md index e1dc167e..630966fc 100644 --- a/tmk_core/doc/keymap.md +++ b/tmk_core/doc/keymap.md @@ -292,7 +292,7 @@ You can specify a **target layer** of action and **when the action is executed** + **layer**: `0`-`31` + **on**: { `ON_PRESS` | `ON_RELEASE` | `ON_BOTH` } -+ **bits**: 4-bit value and 1-bit mask bit ++ **bits**: 5-bit: 1-bit for mask and 4-bit for operand #### 2.2.1 Default Layer @@ -365,20 +365,44 @@ Turns on layer only and clear all layer on release.. #### 2.2.10 Bitwise operation - -**part** indicates which part of 32bit layer state(0-7). **bits** is 5-bit value. **on** indicates when the action is executed. +Performs bitwise operaiton(AND, OR, XOR, SET) against layer state. ACTION_LAYER_BIT_AND(part, bits, on) ACTION_LAYER_BIT_OR(part, bits, on) ACTION_LAYER_BIT_XOR(part, bits, on) ACTION_LAYER_BIT_SET(part, bits, on) -These actions works with parameters as following code. +`part` paramter indicates 0-based index(0-7) of where breaking 32-bit `layer_state` into eight nibbles(4-bit unit). - uint8_t shift = part*4; - uint32_t mask = (bits&0x10) ? ~(0xf< ((bits<) { + case BIT_AND: + layer_state = layer_state & (((bits&0xf)< (((bits&0xf)<