keybrd library is an open source library for creating custom-keyboard firmware.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

Code_LEDLock.h 928B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef CODE_LEDLOCK_H
  2. #define CODE_LEDLOCK_H
  3. #include <Arduino.h>
  4. #include <inttypes.h>
  5. #include <Code.h>
  6. #include <LED.h>
  7. extern volatile uint8_t keyboard_leds;
  8. /* Class Code_LEDLock turns LED on and off
  9. scancode is KEY_CAPS_LOCK, KEY_SCROLL_LOCK, or KEY_NUM_LOCK
  10. In keybrd sketch, ports should be instantiated before Code_LEDLock is instantiated
  11. because LED.off() needs ports to be configured by port constructor.
  12. If a key does not have an LED indictor light, use Code_S instead e.g.:
  13. Code_S CapsLck(KEY_CAPS_LOCK);
  14. */
  15. class Code_LEDLock : public Code
  16. {
  17. private:
  18. const uint16_t scancode;
  19. uint8_t USB_LED_bit; //codes used by keyboard output report
  20. LED& refLED;
  21. void updateLED() const;
  22. public:
  23. Code_LEDLock(const uint16_t scancode, LED& refLED);
  24. virtual void press();
  25. virtual void release();
  26. };
  27. #endif