From 3253f97c880fb74216287d41524989ba2f5e6df2 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 19 Oct 2018 22:26:50 +0200 Subject: [PATCH] hardware: Introduce KeyboardHardware.has_leds Intended to make it easier for LED-using code to bail out early, this simple constant will tell us whether the board has LEDs or if it does not. Because this will be used regularly, by code not close to the hardware, `Kaleidoscope.has_leds` is an alias to `KeyboardHardware.has_leds`. Signed-off-by: Gergely Nagy --- src/kaleidoscope/Kaleidoscope.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/kaleidoscope/Kaleidoscope.h b/src/kaleidoscope/Kaleidoscope.h index aeb03f2f..d77a6020 100644 --- a/src/kaleidoscope/Kaleidoscope.h +++ b/src/kaleidoscope/Kaleidoscope.h @@ -97,6 +97,8 @@ class Kaleidoscope_ { void setup(void); void loop(void); + static constexpr bool has_leds = (KeyboardHardware.led_count > 0); + /** Detaching from / attaching to the host. * * These two functions wrap the hardware plugin's similarly named functions.