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

Change TMO to use layer_state_set_kb as is customary at the keyboard level. #10150

Merged
merged 1 commit into from
Sep 1, 2020
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
37 changes: 27 additions & 10 deletions keyboards/tmo50/tmo50.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,51 @@ void led_set_kb(uint8_t usb_led) {
led_set_user(usb_led);
}

uint32_t layer_state_set_user(uint32_t state)
layer_state_t layer_state_set_kb(layer_state_t state)
{
// if on layer 0, turn on B0 LED, otherwise off.
if (biton32(state) == 0) {
state = layer_state_set_user(state);
process_indicator_led_kb(state);

return state;
}

__attribute__((weak))
bool process_indicator_led_user(layer_state_t state){
return true;
}

bool process_indicator_led_kb(layer_state_t state)
{
if(process_indicator_led_user(state))
{
// if on layer 0, turn on B0 LED, otherwise off.
if (get_highest_layer(state) == 0) {
PORTB &= ~(1<<PB0);
} else {
PORTB |= (1<<PB0);
}

// if on layer 1, turn on B1 LED, otherwise off.
if (biton32(state) == 1) {
// if on layer 1, turn on B1 LED, otherwise off.
if (get_highest_layer(state) == 1) {
PORTB &= ~(1<<PB1);
} else {
PORTB |= (1<<PB1);
}
// if on layer 2, turn on B2 LED, otherwise off.
if (biton32(state) == 2) {

// if on layer 2, turn on B2 LED, otherwise off.
if (get_highest_layer(state) == 2) {
PORTB &= ~(1<<PB2);
} else {
PORTB |= (1<<PB2);
}

// if on layer 3, turn on B3 LED, otherwise off.
if (biton32(state) == 3) {
// if on layer 3, turn on B3 LED, otherwise off.
if (get_highest_layer(state) == 3) {
PORTB &= ~(1<<PB3);
} else {
PORTB |= (1<<PB3);
}
}

return state;
return true;
}
5 changes: 4 additions & 1 deletion keyboards/tmo50/tmo50.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

#include "quantum.h"

bool process_indicator_led_kb(layer_state_t state);
__attribute__((weak))
bool process_indicator_led_user(layer_state_t state);

/* This a shortcut to help you visually see your layout.
*
* The first section contains all of the arguments representing the physical
Expand Down Expand Up @@ -51,4 +55,3 @@
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D }, \
{ K30, K31, K32, K33, KC_NO, KC_NO, KC_NO, K37, KC_NO, KC_NO, K3A, KC_NO, KC_NO, KC_NO } \
}