keybrd library is an open source library for creating custom-keyboard firmware.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
此仓库已存档。您可以查看文件和克隆,但不能推送或创建工单/合并请求。

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