Skip to content

Commit

Permalink
Fix(leds): Update indicators code
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFil committed May 30, 2023
1 parent 7f0f495 commit 4b5ecbc
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 198 deletions.
6 changes: 6 additions & 0 deletions app/include/zmk/hid_indicators.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
#include <zmk/hid.h>
#include <zmk/hid_indicators_types.h>

#define ZMK_LED_NUMLOCK_BIT BIT(0)
#define ZMK_LED_CAPSLOCK_BIT BIT(1)
#define ZMK_LED_SCROLLLOCK_BIT BIT(2)
#define ZMK_LED_COMPOSE_BIT BIT(3)
#define ZMK_LED_KANA_BIT BIT(4)

zmk_hid_indicators zmk_hid_indicators_get_current_profile(void);
zmk_hid_indicators zmk_hid_indicators_get_profile(struct zmk_endpoint_instance endpoint);
void zmk_hid_indicators_set_profile(zmk_hid_indicators indicators,
Expand Down
24 changes: 0 additions & 24 deletions app/include/zmk/led_indicators.h

This file was deleted.

9 changes: 0 additions & 9 deletions app/include/zmk/led_indicators_types.h

This file was deleted.

4 changes: 2 additions & 2 deletions app/include/zmk/rgb_underglow.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#pragma once

#include <zmk/led_indicators_types.h>
#include <zmk/hid_indicators_types.h>

struct zmk_led_hsb {
uint16_t h;
Expand All @@ -16,7 +16,7 @@ struct zmk_led_hsb {

struct zmk_periph_led {
uint8_t layer;
zmk_leds_flags_t indicators;
zmk_hid_indicators indicators;
};

int zmk_rgb_underglow_toggle();
Expand Down
78 changes: 0 additions & 78 deletions app/src/led_indicators.c

This file was deleted.

81 changes: 0 additions & 81 deletions app/src/led_indicators_generic.c

This file was deleted.

8 changes: 4 additions & 4 deletions app/src/rgb_underglow.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
#include <zmk/event_manager.h>
#include <zmk/events/activity_state_changed.h>
#include <zmk/events/usb_conn_state_changed.h>
#include <zmk/events/led_indicator_changed.h>
#include <zmk/events/hid_indicators_changed.h>
#include <zmk/events/split_peripheral_status_changed.h>
#include <zmk/led_indicators.h>
#include <zmk/hid_indicators.h>
#include <zmk/battery.h>
#include <zmk/keymap.h>
#include <zmk/ble.h>
Expand Down Expand Up @@ -222,7 +222,7 @@ static void zmk_rgb_underglow_effect_kinesis() {

old_led_data.layer = led_data.layer;
old_led_data.indicators = led_data.indicators;
led_data.indicators = zmk_leds_get_current_flags();
led_data.indicators = zmk_hid_indicators_get_current_profile();
led_data.layer = zmk_keymap_highest_layer_active();

pixels[0].r = (led_data.indicators & ZMK_LED_CAPSLOCK_BIT) * CONFIG_ZMK_RGB_UNDERGLOW_BRT_SCALE;
Expand Down Expand Up @@ -829,7 +829,7 @@ static int rgb_underglow_event_listener(const zmk_event_t *eh) {

#if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_USB)
if (as_zmk_usb_conn_state_changed(eh)) {
led_data.indicators = zmk_led_indicators_get_current_flags();
led_data.indicators = zmk_hid_indicators_get_current_profile();
led_data.layer = zmk_keymap_highest_layer_active();
int err = zmk_split_bt_update_led(&led_data);
if (err) {
Expand Down

0 comments on commit 4b5ecbc

Please sign in to comment.