~ruther/qmk_firmware

1124bbc1db8fb26418bded7016c702de469b162f — Joel Challis 2 years ago 0fcf481
Remove deprecated led_set_kb (#19273)

* Remove led_set_kb maintaining existing led_set_user behaviour

* Also call led_set_user
M docs/feature_led_indicators.md => docs/feature_led_indicators.md +1 -1
@@ 19,7 19,7 @@ There are three ways to get the lock LED state:

Two deprecated functions that provide the LED state as `uint8_t`:

* `uint8_t led_set_kb(uint8_t usb_led)` and `_user(uint8_t usb_led)`
* `uint8_t led_set_user(uint8_t usb_led)`
* `uint8_t host_keyboard_leds()`

## Configuration Options

M docs/hardware_keyboard_guidelines.md => docs/hardware_keyboard_guidelines.md +1 -1
@@ 188,7 188,7 @@ The following functions are typically defined in this file:
* `void matrix_init_kb(void)`
* `void matrix_scan_kb(void)`
* `bool process_record_kb(uint16_t keycode, keyrecord_t *record)`
* `void led_set_kb(uint8_t usb_led)`
* `bool led_update_kb(led_t led_state)`

### `<keyboard_name.h>`


M docs/ja/feature_led_indicators.md => docs/ja/feature_led_indicators.md +1 -1
@@ 22,7 22,7 @@ QMK は HID 仕様で定義された5つの LED の読み取りメソッドを

LED の状態を `uint8_t` として提供する2つの非推奨の関数があります:

* `uint8_t led_set_kb(uint8_t usb_led)` と `_user(uint8_t usb_led)`
* `uint8_t led_set_user(uint8_t usb_led)`
* `uint8_t host_keyboard_leds()`

## 設定オプション :id=configuration-options

M docs/ja/hardware_keyboard_guidelines.md => docs/ja/hardware_keyboard_guidelines.md +1 -1
@@ 165,7 165,7 @@ Clueboard は、サブフォルダをまとめるためとキーボードのリ
* `void matrix_init_kb(void)`
* `void matrix_scan_kb(void)`
* `bool process_record_kb(uint16_t keycode, keyrecord_t *record)`
* `void led_set_kb(uint8_t usb_led)`
* `bool led_update_kb(led_t led_state)`

### `<keyboard_name.h>`


M keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c => keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c +4 -4
@@ 95,13 95,13 @@ void matrix_scan_user(void) {
        current_layer_global = layer;

        // unset CAPSLOCK and SCROLL LOCK LEDs
        led_set_kb(host_keyboard_leds() & ~(1<<USB_LED_CAPS_LOCK));
        led_set_kb(host_keyboard_leds() & ~(1<<USB_LED_SCROLL_LOCK));
        led_set(host_keyboard_leds() & ~(1<<USB_LED_CAPS_LOCK));
        led_set(host_keyboard_leds() & ~(1<<USB_LED_SCROLL_LOCK));
        // set SCROLL LOCK LED when the mouse layer is active, CAPS LOCK when PROG layer is active
        if (layer == MOUSE1 || layer == MOUSE2) {
          led_set_kb(host_keyboard_leds() | (1<<USB_LED_SCROLL_LOCK));
          led_set(host_keyboard_leds() | (1<<USB_LED_SCROLL_LOCK));
        } else if (layer == PROG1 || layer == PROG2) {
          led_set_kb(host_keyboard_leds() | (1<<USB_LED_CAPS_LOCK));
          led_set(host_keyboard_leds() | (1<<USB_LED_CAPS_LOCK));
        }
    }
}

M keyboards/converter/usb_usb/custom_matrix.cpp => keyboards/converter/usb_usb/custom_matrix.cpp +2 -1
@@ 233,6 233,7 @@ extern "C" {
        if (kbd2.isReady()) kbd2.SetReport(0, 0, 2, 0, 1, &usb_led);
        if (kbd3.isReady()) kbd3.SetReport(0, 0, 2, 0, 1, &usb_led);
        if (kbd4.isReady()) kbd4.SetReport(0, 0, 2, 0, 1, &usb_led);
        led_set_kb(usb_led);
        led_set_user(usb_led);
        led_update_kb((led_t)usb_led)
    }
}

M keyboards/duck/octagon/v1/v1.c => keyboards/duck/octagon/v1/v1.c +7 -3
@@ 40,7 40,11 @@ void backlight_set(uint8_t level) {
  level & BACKLIGHT_RGBBLUE ? (PORTD |= 0b00010000) : (PORTD &= ~0b00010000);
}

void led_set_kb(uint8_t usb_led) {
  backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
  backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
bool led_update_kb(led_t led_state) {
  bool res = led_update_user(led_state);
  if(res) {
    backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
    backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
  }
  return res;
}

M keyboards/duck/octagon/v2/v2.c => keyboards/duck/octagon/v2/v2.c +16 -12
@@ 97,17 97,21 @@ void backlight_set(uint8_t level) {
}

// Port from backlight_update_state
void led_set_kb(uint8_t usb_led) {
bool led_update_kb(led_t led_state) {
  bool res = led_update_user(led_state);
  if(res) {
    bool status[7] = {
    backlight_os_state & (1<<USB_LED_CAPS_LOCK),
    backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
    backlight_os_state & (1<<USB_LED_NUM_LOCK),
    backlight_layer_state & (1<<1),
    backlight_layer_state & (1<<2),
    backlight_layer_state & (1<<3),
    backlight_layer_state & (1<<4)
  };
  indicator_leds_set(status);
  backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
  backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
      backlight_os_state & (1<<USB_LED_CAPS_LOCK),
      backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
      backlight_os_state & (1<<USB_LED_NUM_LOCK),
      backlight_layer_state & (1<<1),
      backlight_layer_state & (1<<2),
      backlight_layer_state & (1<<3),
      backlight_layer_state & (1<<4)
    };
    indicator_leds_set(status);
    backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
    backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
  }
  return res;
}

M keyboards/duck/tcv3/tcv3.c => keyboards/duck/tcv3/tcv3.c +17 -13
@@ 100,19 100,23 @@ void backlight_set(uint8_t level) {
}

// // Port from backlight_update_state
// void led_set_kb(uint8_t usb_led) {
//     bool status[7] = {
//     backlight_os_state & (1<<USB_LED_CAPS_LOCK),
//     backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
//     backlight_os_state & (1<<USB_LED_NUM_LOCK),
//     backlight_layer_state & (1<<1),
//     backlight_layer_state & (1<<2),
//     backlight_layer_state & (1<<3),
//     backlight_layer_state & (1<<4)
//   };
//   indicator_leds_set(status);
//   backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
//   backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
// bool led_update_kb(led_t led_state) {
//   bool res = led_update_user(led_state);
//   if(res) {
//       bool status[7] = {
//       backlight_os_state & (1<<USB_LED_CAPS_LOCK),
//       backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
//       backlight_os_state & (1<<USB_LED_NUM_LOCK),
//       backlight_layer_state & (1<<1),
//       backlight_layer_state & (1<<2),
//       backlight_layer_state & (1<<3),
//       backlight_layer_state & (1<<4)
//     };
//     indicator_leds_set(status);
//     backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
//     backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
//   }
//   return res;
// }

// U5 Pin 1, 2, 3 connected to top left LEDs

M keyboards/exclusive/e6v2/oe/oe.c => keyboards/exclusive/e6v2/oe/oe.c +12 -29
@@ 1,32 1,15 @@
#include "oe.h"

void led_set_kb(uint8_t usb_led) {
	// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
	DDRB |= (1<<6);
	if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
			// output low
			DDRB |= (1<<2);
			PORTB &= ~(1<<2);
		} else {
			// Hi-Z
			DDRB &= ~(1<<2);
			PORTB &= ~(1<<2);
		}
	// DDRB |= (1<<7);
	// DDRB |= (1<<1);
	// DDRB |= (1<<3);
	// DDRE |= (1<<6);
	if (usb_led == 0){
		PORTB |= (1<<6);
		// PORTB |= (1<<7);
		// PORTB |= (1<<1);
		// PORTB |= (1<<3);
		// PORTE |= (1<<6);
	}
	else{
		PORTB &= ~(1<<6);
		// PORTB &= ~(1<<7);
	}
    
	led_set_user(usb_led);
void led_init_ports(void) {
    setPinOutput(B2);
    setPinOutput(B6);
}

bool led_update_kb(led_t led_state) {
    bool res = led_update_user(led_state);
    if(res) {
        writePin(B2, !led_state.caps_lock);
        writePin(B6, led_state == 0);
    }
    return res;
}

M keyboards/sirius/unigo66/custom_matrix.cpp => keyboards/sirius/unigo66/custom_matrix.cpp +2 -1
@@ 220,7 220,8 @@ extern "C"
        kbd2.SetReport(0, 0, 2, 0, 1, &usb_led);
        kbd3.SetReport(0, 0, 2, 0, 1, &usb_led);
        kbd4.SetReport(0, 0, 2, 0, 1, &usb_led);
        led_set_kb(usb_led);
        led_set_user(usb_led);
        led_update_kb((led_t)usb_led)
    }

};

M layouts/community/ortho_4x12/wanleg/readme.md => layouts/community/ortho_4x12/wanleg/readme.md +0 -8
@@ 23,14 23,6 @@ In `qmk_firmware/keyboards/lets_split/rev2/rev2.c`, replace contents with
```  
#include "lets_split.h"


#ifdef SSD1306OLED
void led_set_kb(uint8_t usb_led) {
    // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
    led_set_user(usb_led);
}
#endif

void matrix_init_kb(void) {

    // // green led on

M quantum/led.c => quantum/led.c +1 -9
@@ 69,14 69,6 @@ uint32_t last_led_activity_elapsed(void) {
 */
__attribute__((weak)) void led_set_user(uint8_t usb_led) {}

/** \brief Lock LED set callback - keyboard level
 *
 * \deprecated Use led_update_kb() instead.
 */
__attribute__((weak)) void led_set_kb(uint8_t usb_led) {
    led_set_user(usb_led);
}

/** \brief Lock LED update callback - keymap/user level
 *
 * \return True if led_update_kb() should run its own code, false otherwise.


@@ 154,7 146,7 @@ __attribute__((weak)) void led_set(uint8_t usb_led) {
    handle_backlight_caps_lock((led_t)usb_led);
#endif

    led_set_kb(usb_led);
    led_set_user(usb_led);
    led_update_kb((led_t)usb_led);
}


M quantum/led.h => quantum/led.h +3 -2
@@ 55,9 55,10 @@ void led_wakeup(void);

void led_task(void);

/* Callbacks */
/* Deprecated callbacks */
void led_set_user(uint8_t usb_led);
void led_set_kb(uint8_t usb_led);

/* Callbacks */
bool led_update_user(led_t led_state);
bool led_update_kb(led_t led_state);
void led_update_ports(led_t led_state);