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

adding a feature that shows current layer number in binary #83

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
27 changes: 26 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

// ----------------------------------------------------------------------------

uint8_t layers_head = 0;

static bool _main_kb_is_pressed[KB_ROWS][KB_COLUMNS];
bool (*main_kb_is_pressed)[KB_ROWS][KB_COLUMNS] = &_main_kb_is_pressed;

Expand Down Expand Up @@ -131,6 +133,30 @@ int main(void) {
else { kb_led_compose_off(); }
if (keyboard_leds & (1<<4)) { kb_led_kana_on(); }
else { kb_led_kana_off(); }


#ifdef LEDS_SHOW_LAYER_IN_BINARY
if (layers_head!=0) {

kb_led_num_off();
kb_led_caps_off();
kb_led_scroll_off();

if (layers_head&(1<<0))
kb_led_scroll_on();
if (layers_head&(1<<1))
kb_led_caps_on();
if (layers_head&(1<<2))
kb_led_num_on();

}
else {
kb_led_num_off();
kb_led_caps_off();
kb_led_scroll_off();
}
#endif

}

return 0;
Expand Down Expand Up @@ -168,7 +194,6 @@ struct layers {
// ----------------------------------------------------------------------------

struct layers layers[MAX_ACTIVE_LAYERS];
uint8_t layers_head = 0;
uint8_t layers_ids_in_use[MAX_ACTIVE_LAYERS] = {true};

/*
Expand Down
4 changes: 3 additions & 1 deletion src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ MCU := atmega32u4 # processor type (for teensy 2.0); must match real life
BOARD := teensy-2-0 # see the libraries you're using for what's available
F_CPU := 16000000 # processor speed, in Hz

#if set to true, the num,scroll,caps LED's will display current layer number in binary
# firmware stuff
SRC := $(wildcard *.c)
# keyboard and layout stuff
Expand Down Expand Up @@ -47,9 +48,10 @@ SRC += $(wildcard lib-other/*/*/*.c)

OBJ = $(SRC:%.c=%.o)

CFLAGS := -DLEDS_SHOW_LAYER_IN_BINARY=

# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CFLAGS := -mmcu=$(MCU) # processor type (teensy 2.0); must match real
CFLAGS += -mmcu=$(MCU) # processor type (teensy 2.0); must match real
# life
CFLAGS += -DF_CPU=$(F_CPU) # processor frequency; must match initialization
# in source
Expand Down