Make the LED update API a bit more flexible

pull/18/head
Jesse Vincent 9 years ago
parent 679d65d6b8
commit d5ebc7c5ad

@ -46,7 +46,7 @@ void loop() {
x = 0; x = 0;
y = 0; y = 0;
scan_matrix(); scan_matrix();
LEDs.update_leds(temporary_keymap == NUMPAD_KEYMAP); LEDs.update_leds(temporary_keymap);
Keyboard.sendReport(); Keyboard.sendReport();
Keyboard.releaseAll(); Keyboard.releaseAll();
handle_mouse_movement(x, y); handle_mouse_movement(x, y);

@ -55,14 +55,14 @@ void LEDControl::set_led_mode(uint8_t mode) {
void LEDControl::update_leds(uint8_t numlock_enabled) { void LEDControl::update_leds(uint8_t current_keymap) {
if (numlock_enabled) { if (current_keymap == NUMPAD_KEYMAP) {
if (led_mode != LED_SPECIAL_MODE_NUMLOCK) { if (led_mode != LED_SPECIAL_MODE_NUMLOCK) {
stored_led_mode = led_mode; stored_led_mode = led_mode;
} }
led_mode = LED_SPECIAL_MODE_NUMLOCK; led_mode = LED_SPECIAL_MODE_NUMLOCK;
} }
if (!numlock_enabled && if (current_keymap != NUMPAD_KEYMAP &&
led_mode == LED_SPECIAL_MODE_NUMLOCK led_mode == LED_SPECIAL_MODE_NUMLOCK
) { ) {
led_mode = stored_led_mode; led_mode = stored_led_mode;

@ -20,7 +20,7 @@ class LEDControl {
public: public:
void next_led_mode(); void next_led_mode();
void led_bootup(); void led_bootup();
void update_leds(uint8_t numlock_enabled); void update_leds(uint8_t current_keymap);
void led_type_letter(uint8_t letter); void led_type_letter(uint8_t letter);
void set_led_mode(uint8_t mode); void set_led_mode(uint8_t mode);

Loading…
Cancel
Save