Skip to content
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
4 changes: 2 additions & 2 deletions keyboards/nuphy/air96_v2/ansi/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ c# NuPhy Air96 V2

Make example for this keyboard (after setting up your build environment):

make nuphy/air96_v2/ansi:default
make nuphy/air96_v2/ansi:via

Flashing example for this keyboard:

make nuphy/air96_v2/ansi:default:flash
make nuphy/air96_v2/ansi:via:flash

See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

Expand Down
51 changes: 40 additions & 11 deletions keyboards/nuphy/air96_v2/ansi/side.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ uint8_t side_play_cnt = 0;
uint32_t side_play_timer = 0;
uint8_t r_temp, g_temp, b_temp;

typedef struct keyb_indicators_t
{
union {
struct {
uint8_t caps_lock:1;
uint8_t num_lock:1;
/*
uint8_t scroll_lock:1;
*/
};
uint8_t indicator_flags;
};
} keyb_indicators_t;

extern DEV_INFO_STRUCT dev_info;
extern bool f_bat_hold;
extern user_config_t user_config;
Expand Down Expand Up @@ -239,6 +253,20 @@ void set_right_rgb(uint8_t r, uint8_t g, uint8_t b)
rgb_matrix_set_color(SIDE_INDEX + SIDE_LINE + i, r, g, b);
}

/**
* @brief set indicator leds
* @param ...
*/
void set_indicator_leds(keyb_indicators_t inds)
{
if (inds.caps_lock) {
set_left_rgb(0X00, SIDE_BLINK_LIGHT, SIDE_BLINK_LIGHT);
}
if (inds.num_lock) {
set_right_rgb(0X00, SIDE_BLINK_LIGHT, SIDE_BLINK_LIGHT);
}
}

/**
* @brief system switch led show
*/
Expand Down Expand Up @@ -312,20 +340,21 @@ void sleep_sw_led_show(void)
}

/**
* @brief host system led indicate.
* @brief show "keyboard indicators" (caps/num/...), these indicators are set from host system
*/
void sys_led_show(void)
void keyb_indicators_show(void)
{
keyb_indicators_t inds = { .caps_lock = 0, .num_lock = 0 };

if (dev_info.link_mode == LINK_USB) {
if (host_keyboard_led_state().caps_lock) {
set_left_rgb(0X00, SIDE_BLINK_LIGHT, SIDE_BLINK_LIGHT);
}
}
else {
if (dev_info.rf_led & 0x02) {
set_left_rgb(0X00, SIDE_BLINK_LIGHT, SIDE_BLINK_LIGHT);
}
inds.caps_lock = (host_keyboard_led_state().caps_lock != 0);
inds.num_lock = (host_keyboard_led_state().num_lock != 0);
} else {
inds.caps_lock = ((dev_info.rf_led & 0x02) != 0);
inds.num_lock = ((dev_info.rf_led & 0x01) != 0);
}

set_indicator_leds(inds);
}

/**
Expand Down Expand Up @@ -862,6 +891,6 @@ void m_side_led_show(void)
sleep_sw_led_show();
sys_sw_led_show();

sys_led_show();
keyb_indicators_show();
rf_led_show();
}