tmk / tmk_keyboard

Keyboard firmwares for Atmel AVR and Cortex-M
3.98k stars 1.7k forks source link

Converters should use `hook_keyboard_leds_change()` #665

Open tmk opened 3 years ago

tmk commented 3 years ago

instead of keyboard_set_leds() or led_set() to allow users to replace default behaviour of lock key indicators.

ibmpc_usb patch for example

iff --git a/converter/ibmpc_usb/ibmpc_usb.c b/converter/ibmpc_usb/ibmpc_usb.c
index 6d22ad73..ac6defd2 100644
--- a/converter/ibmpc_usb/ibmpc_usb.c
+++ b/converter/ibmpc_usb/ibmpc_usb.c
@@ -26,6 +26,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "matrix.h"
 #include "timer.h"
 #include "action.h"
+#include "hook.h"
 #include "ibmpc_usb.h"
 #include "ibmpc.h"

@@ -323,6 +324,7 @@ uint8_t matrix_scan(void)
                     break;
                 case PC_AT:
                     led_set(host_keyboard_leds());
+                    //hook_keyboard_leds_change(host_keyboard_leds());
                     break;
                 case PC_AT_Z150:
                     // TODO: do not set indicators temporarily for debug
@@ -332,6 +334,7 @@ uint8_t matrix_scan(void)
                     ibmpc_host_send(0xF8);
                     // This should not be harmful
                     led_set(host_keyboard_leds());
+                    //hook_keyboard_leds_change(host_keyboard_leds());
                     break;
                 default:
                     break;