Additional changes for Layer State typedef compatibility

pull/6512/head
Drashna Jaelre 6 years ago committed by Florian Didron
parent 04eb1226b9
commit e0eecc6834

@ -881,9 +881,9 @@ void set_single_persistent_default_layer(uint8_t default_layer) {
default_layer_set(1U<<default_layer);
}
uint32_t update_tri_layer_state(uint32_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3) {
uint32_t mask12 = (1UL << layer1) | (1UL << layer2);
uint32_t mask3 = 1UL << layer3;
layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3) {
layer_state_t mask12 = (1UL << layer1) | (1UL << layer2);
layer_state_t mask3 = 1UL << layer3;
return (state & mask12) == mask12 ? (state | mask3) : (state & ~mask3);
}

@ -213,7 +213,7 @@ void send_char(char ascii_code);
// For tri-layer
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
uint32_t update_tri_layer_state(uint32_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3);
layer_state_t update_tri_layer_state(layer_state_t state, uint8_t layer1, uint8_t layer2, uint8_t layer3);
void set_single_persistent_default_layer(uint8_t default_layer);

@ -23,10 +23,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#if defined(LAYER_STATE_8BIT) || ( defined(DYNAMIC_KEYMAP_ENABLE) && DYNAMIC_KEYMAP_LAYER_COUNT >= 8 )
typedef uint8_t layer_state_t;
#define get_highest_layer(state) biton8(state)
#elif defined(LAYER_STATE_16BIT)
typedef uint16_t layer_state_t;
#define get_highest_layer(state) biton16(state)
#else
typedef uint32_t layer_state_t;
#define get_highest_layer(state) biton32(state)
#endif

Loading…
Cancel
Save